Skip to content

Commit

Permalink
Merge pull request #2 from canonbrother/canonbrother/handle-1-2
Browse files Browse the repository at this point in the history
Fix: handle tx ver 1 (genesis) as well
  • Loading branch information
Jouzo authored Jan 23, 2024
2 parents c1a3d00 + 6a0cd73 commit b0d7217
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion bitcoin/src/blockdata/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ impl fmt::Debug for Header {
.field("merkle_root", &self.merkle_root)
.field("time", &self.time)
.field("bits", &self.bits)
.field("bits", &self.bits)
.field("stake_modifier", &self.stake_modifier)
.field("deprecated_height", &self.deprecated_height)
.field("minted_blocks", &self.minted_blocks)
Expand Down
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 b0d7217

Please sign in to comment.