From bd7158afa81609050d0d6c2cb7ba7f0a77423360 Mon Sep 17 00:00:00 2001 From: aya015757881 <2581015450@qq.com> Date: Fri, 26 Jul 2024 11:15:58 +0800 Subject: [PATCH 1/2] fix: bitcoin decode fails on Sighash deserialization --- anychain-bitcoin/src/transaction.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/anychain-bitcoin/src/transaction.rs b/anychain-bitcoin/src/transaction.rs index 9069c3c..09347e6 100644 --- a/anychain-bitcoin/src/transaction.rs +++ b/anychain-bitcoin/src/transaction.rs @@ -278,7 +278,6 @@ impl fmt::Display for SignatureHash { impl SignatureHash { pub fn from_byte(byte: &u8) -> Self { match byte { - 0x01 => SignatureHash::SIGHASH_ALL, 0x02 => SignatureHash::SIGHASH_NONE, 0x03 => SignatureHash::SIGHASH_SINGLE, 0x41 => SignatureHash::SIGHASH_ALL_SIGHASH_FORKID, @@ -290,7 +289,7 @@ impl SignatureHash { 0xc1 => SignatureHash::SIGHASH_ALL_SIGHASH_FORKID_SIGHASH_ANYONECANPAY, 0xc2 => SignatureHash::SIGHASH_NONE_SIGHASH_FORKID_SIGHASH_ANYONECANPAY, 0xc3 => SignatureHash::SIGHASH_SINGLE_SIGHASH_FORKID_SIGHASH_ANYONECANPAY, - _ => panic!("Unrecognized signature hash"), + _ => SignatureHash::SIGHASH_ALL, } } } From 99169fa6e8a96df85b570e6c4869d78a4dba6478 Mon Sep 17 00:00:00 2001 From: aya015757881 <2581015450@qq.com> Date: Fri, 26 Jul 2024 11:22:08 +0800 Subject: [PATCH 2/2] fix: SigHash decode error --- Cargo.lock | 2 +- anychain-bitcoin/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1279c6d..78f6c34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -138,7 +138,7 @@ dependencies = [ [[package]] name = "anychain-bitcoin" -version = "0.1.6" +version = "0.1.7" dependencies = [ "anychain-core", "base58", diff --git a/anychain-bitcoin/Cargo.toml b/anychain-bitcoin/Cargo.toml index 5bac6e7..c29328f 100644 --- a/anychain-bitcoin/Cargo.toml +++ b/anychain-bitcoin/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "anychain-bitcoin" description = "A Rust library for Bitcoin-focused cryptocurrency wallets, enabling seamless transactions on the Bitcoin blockchain" -version = "0.1.6" +version = "0.1.7" keywords = ["bitcoin", "blockchain", "cryptocurrencies", "wallet", "transactions"] # Workspace inherited keys