From e946575f7684c537da803c1f081787b986eecebc Mon Sep 17 00:00:00 2001 From: Ian Slane Date: Sat, 20 Apr 2024 20:18:26 -0600 Subject: [PATCH] testing witness root calc --- mine-your-first-block/src/main.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mine-your-first-block/src/main.rs b/mine-your-first-block/src/main.rs index 78a0137..ee299f9 100644 --- a/mine-your-first-block/src/main.rs +++ b/mine-your-first-block/src/main.rs @@ -157,11 +157,13 @@ fn create_coinbase_tx(total_tx_fee: u64, witness_root: String) -> Transaction { // }); // Made some edits to work directly with bytes so i didnt have to decode and encode let op_return_prefix = vec![0x6a, 0x24, 0xaa, 0x21, 0xa9, 0xed]; + // let witness_root_bytes = hex::decode(witness_root).unwrap(); let witness_root_bytes = hex::decode(witness_root).unwrap(); + let reversed_witness_root_bytes: Vec = witness_root_bytes.into_iter().rev().collect(); let witness_reserved_value_bytes = hex::decode(witness_reserved_value).unwrap(); let mut wtxid_commitment = Vec::new(); - wtxid_commitment.extend(witness_root_bytes); + wtxid_commitment.extend(reversed_witness_root_bytes); wtxid_commitment.extend(witness_reserved_value_bytes); let wtxid_commitment_hash = double_sha256(wtxid_commitment); @@ -1249,7 +1251,6 @@ fn process_mempool(mempool_path: &str) -> io::Result