Skip to content

Commit

Permalink
expand Display implementation of PrimitiveWitness
Browse files Browse the repository at this point in the history
Now also output tx kernel values.
  • Loading branch information
Sword-Smith committed Oct 11, 2024
1 parent 5cedbd8 commit e044769
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/models/blockchain/transaction/primitive_witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,24 @@ impl Display for PrimitiveWitness {
None => "No".to_owned(),
};
let utxo_digests = self.input_utxos.utxos.iter().map(Hash::hash);
let kernel_merkle_tree = self.kernel.merkle_tree();
let kernel_mt_leafs = kernel_merkle_tree.leafs();
write!(
f,
"inputs: [{}]\noutputs: [{}]\ncoinbase: {}\nfee: {}\ntxk mast hash: {}\n\ninput canonical commitments:\n{}\n\n",
"inputs: [{}]\noutputs: [{}]\ncoinbase: {}\nfee: {}\n\
txk mast hash: {}\n\ninput canonical commitments:\n{}\n\
kernel mast hash leafs:\n{}\n\n\n",
self.input_utxos,
self.output_utxos,
coinbase_str,
self.kernel.fee,
self.kernel.mast_hash(),
self.input_membership_proofs.iter().zip_eq(utxo_digests).map(|(msmp, utxo_digest)| msmp.addition_record(utxo_digest).canonical_commitment).join("\n")
self.input_membership_proofs
.iter()
.zip_eq(utxo_digests)
.map(|(msmp, utxo_digest)| msmp.addition_record(utxo_digest).canonical_commitment)
.join("\n"),
kernel_mt_leafs.iter().join("\n"),
)
}
}
Expand Down

0 comments on commit e044769

Please sign in to comment.