Skip to content

Commit

Permalink
handle old tx 1 & 2
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Jan 23, 2024
1 parent 30d5659 commit 6a0cd73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bitcoin/src/blockdata/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down Expand Up @@ -1134,7 +1134,7 @@ impl Decodable for Transaction {
// BIP144 input witnesses
1 => {
let mut input = Vec::<TxIn>::consensus_decode_from_finite_reader(r)?;
let output = if version == Version::TWO {
let output = if version.is_standard() {
Vec::<TxOutV2>::consensus_decode_from_finite_reader(r)?
.into_iter()
.map(Into::into)
Expand Down Expand Up @@ -1165,7 +1165,7 @@ impl Decodable for Transaction {
version,
input,
output: {
if version == Version::TWO {
if version.is_standard() {
Vec::<TxOutV2>::consensus_decode_from_finite_reader(r)?
.into_iter()
.map(Into::into)
Expand Down

0 comments on commit 6a0cd73

Please sign in to comment.