From 0bb2db99b7099b6af0cc12d301f739324b8daac2 Mon Sep 17 00:00:00 2001 From: "Ryan.K" Date: Sun, 28 Apr 2024 19:54:56 +0800 Subject: [PATCH] fixed bip191 sig --- Cargo.toml | 2 +- crates/core/src/ecc/signers/bip137.rs | 10 +++++----- package.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 48144300..b999fdf8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["crates/*", "examples/native", "examples/snark"] [workspace.package] -version = "0.6.1" +version = "0.7.0" edition = "2021" license = "GPL-3.0" authors = ["RND "] diff --git a/crates/core/src/ecc/signers/bip137.rs b/crates/core/src/ecc/signers/bip137.rs index 75f503f5..eb497e3d 100644 --- a/crates/core/src/ecc/signers/bip137.rs +++ b/crates/core/src/ecc/signers/bip137.rs @@ -6,8 +6,8 @@ use sha2::Sha256; use crate::ecc::PublicKey; use crate::ecc::PublicKeyAddress; -use crate::error::Result; use crate::error::Error; +use crate::error::Result; /// recover pubkey according to signature. /// | y-parity | x-order | compression | recovery id | v | @@ -28,11 +28,11 @@ pub fn recover(msg: &[u8], sig: impl AsRef<[u8]>) -> Result { let hash = self::magic_hash(msg); if sig_byte[64] >= 27 && sig_byte[64] <= 30 { - sig_byte[64] -= 27; - } else if sig_byte[64] >=31 && sig_byte[64] <= 34 { - sig_byte[64] -= 31; + sig_byte[64] -= 27; + } else if sig_byte[64] >= 31 && sig_byte[64] <= 34 { + sig_byte[64] -= 31; } else { - return Err(Error::InvalidRecoverId(sig_byte[64])) + return Err(Error::InvalidRecoverId(sig_byte[64])); } crate::ecc::recover_hash(&hash, sig_byte) } diff --git a/package.json b/package.json index c8596d09..ab06561a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "RND " ], "description": "Rings is a structured peer-to-peer network implementation using WebRTC, Chord algorithm, and full WebAssembly (WASM) support.\n", - "version": "0.6.1", + "version": "0.7.0", "license": "GPL-3.0", "repository": { "type": "git",