From fd18e5c378a093dfb8949ae21701ae1911ebc480 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sun, 16 Apr 2023 18:09:25 +0200 Subject: [PATCH] explorer: fix witness size computation --- Cargo.lock | 2 +- Cargo.toml | 4 ++-- src/bin/btc-expl.rs | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4be6a28..8c703cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -418,7 +418,7 @@ dependencies = [ [[package]] name = "descriptor-wallet" -version = "0.9.1" +version = "0.9.2" dependencies = [ "aes", "amplify", diff --git a/Cargo.toml b/Cargo.toml index c2c47a2..8aba3a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "descriptor-wallet" -version = "0.9.1" +version = "0.9.2" license = "Apache-2.0" authors = ["Dr. Maxim Orlovsky "] description = "Libraries and command line tool for building descriptor-based bitcoin wallets" @@ -31,7 +31,7 @@ name = "btc-expl" required-features = ["cli", "compiler"] [dependencies] -amplify = "3.13.0" +amplify = "3.14.2" strict_encoding_crate = { package = "strict_encoding", version = "0.9.0", features = ["bitcoin", "derive"], optional = true } bitcoin = "0.29.2" bitcoin_scripts = "0.9.1" diff --git a/src/bin/btc-expl.rs b/src/bin/btc-expl.rs index 79ab5e8..d5c2eca 100644 --- a/src/bin/btc-expl.rs +++ b/src/bin/btc-expl.rs @@ -129,6 +129,8 @@ impl Args { println!(); for (vin, (prev_tx, txin)) in prev_txs.into_iter().zip(tx.input).enumerate() { + witness_size += txin.witness.iter().map(<[u8]>::len).sum::(); + let prevout = &prev_tx.output[txin.previous_output.vout as usize]; println!( "{} {} <- {}", @@ -316,7 +318,6 @@ impl Args { _ => { println!(" witness stack:"); for el in txin.witness.iter() { - witness_size += el.len(); println!(" - {}", el.to_hex()); } }