Skip to content

Commit

Permalink
Fixed the le, crossing my fingers test will pass
Browse files Browse the repository at this point in the history
  • Loading branch information
slanesuke committed Apr 17, 2024
1 parent 4028d42 commit 3d9979c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mine-your-first-block/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,11 +953,14 @@ fn main() {
// Generate coinbase tx
let coinbase_tx = create_coinbase_tx(total_fees);
let serialized_cb_tx = serialize_tx(&coinbase_tx);
let cd_tx_bytes = hex::decode(serialized_cb_tx).unwrap();

// coinbase txid
let coinbase_txid = double_sha256(serialized_cb_tx.as_bytes().to_vec());
let coinbase_txid = double_sha256(cd_tx_bytes);
// Reverse the bytes
let coinbase_txid = coinbase_txid.iter().rev().cloned().collect::<Vec<u8>>();
let mut coinbase_txid_le = coinbase_txid.to_vec();
coinbase_txid_le.reverse();
let coinbase_txid = hex::encode(coinbase_txid_le);

// Insert the coinbase txid at the beginning of the valid_txids vector
sorted_txids.insert(0, hex::encode(coinbase_txid));
Expand Down

0 comments on commit 3d9979c

Please sign in to comment.