Skip to content

Commit

Permalink
fixed bip191 sig
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanKung committed Apr 28, 2024
1 parent 3db30c2 commit 0bb2db9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
Expand Down
10 changes: 5 additions & 5 deletions crates/core/src/ecc/signers/bip137.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -28,11 +28,11 @@ pub fn recover(msg: &[u8], sig: impl AsRef<[u8]>) -> Result<PublicKey> {
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)
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"RND <[email protected]>"
],
"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",
Expand Down

0 comments on commit 0bb2db9

Please sign in to comment.