From 6a0cd73fd194fd12afe5c0ab5142ebbefde21e0a Mon Sep 17 00:00:00 2001 From: canonbrother Date: Tue, 23 Jan 2024 16:06:08 +0800 Subject: [PATCH] handle old tx 1 & 2 --- bitcoin/src/blockdata/transaction.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs index 54c7b9b7..841777ff 100644 --- a/bitcoin/src/blockdata/transaction.rs +++ b/bitcoin/src/blockdata/transaction.rs @@ -1102,7 +1102,7 @@ impl Encodable for Transaction { len += SEGWIT_FLAG.consensus_encode(w)?; len += self.input.consensus_encode(w)?; - len += if self.version == Version::TWO { + len += if self.version.is_standard() { self.output.iter().try_fold(0usize, |acc, tx| { let value_len = tx.value.consensus_encode(w)?; let script_len = tx.script_pubkey.consensus_encode(w)?; @@ -1134,7 +1134,7 @@ impl Decodable for Transaction { // BIP144 input witnesses 1 => { let mut input = Vec::::consensus_decode_from_finite_reader(r)?; - let output = if version == Version::TWO { + let output = if version.is_standard() { Vec::::consensus_decode_from_finite_reader(r)? .into_iter() .map(Into::into) @@ -1165,7 +1165,7 @@ impl Decodable for Transaction { version, input, output: { - if version == Version::TWO { + if version.is_standard() { Vec::::consensus_decode_from_finite_reader(r)? .into_iter() .map(Into::into)