Skip to content

Commit

Permalink
reversed witness root
Browse files Browse the repository at this point in the history
  • Loading branch information
slanesuke committed Apr 21, 2024
1 parent be5b3bf commit 9bf2faa
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions mine-your-first-block/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ fn create_coinbase_tx(total_tx_fee: u64, witness_root: String) -> Transaction {
// the scriptpubkey of the second output
// 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 mut witness_root_bytes = hex::decode(witness_root).unwrap();
let witness_reserved_value_bytes = hex::decode(witness_reserved_value).unwrap();
witness_root_bytes.reverse();

let mut wtxid_commitment = Vec::new();
wtxid_commitment.extend(witness_root_bytes);
Expand Down Expand Up @@ -1470,11 +1471,6 @@ fn write_block_to_file(serialized_header: &[u8], serialized_cb_tx: &[u8], txs: V
//println!("{}", &tx.txid);
append_to_file("../output.txt", &tx.txid).unwrap();
}
//let len = txs.len() / 2;
// for txids in txs {
// //println!("{}", txids);
// append_to_file("../output.txt", &txids).unwrap();
// }
}


Expand Down

0 comments on commit 9bf2faa

Please sign in to comment.