From 8e33c790753a0c6964e985822226ca1cf1835f75 Mon Sep 17 00:00:00 2001 From: Ian Slane Date: Tue, 16 Apr 2024 22:56:27 -0600 Subject: [PATCH] test --- mine-your-first-block/src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mine-your-first-block/src/main.rs b/mine-your-first-block/src/main.rs index 815d5a5..694e556 100644 --- a/mine-your-first-block/src/main.rs +++ b/mine-your-first-block/src/main.rs @@ -953,12 +953,13 @@ fn main() { // Generate coinbase tx let coinbase_tx = create_coinbase_tx(total_fees); let serialized_cb_tx = serialize_tx(&coinbase_tx); + println!("Coinbase TX: {}", serialized_cb_tx); let cd_tx_bytes = hex::decode(serialized_cb_tx.clone()).unwrap(); // coinbase txid let coinbase_txid = double_sha256(cd_tx_bytes); // Reverse the bytes - let mut coinbase_txid_le = coinbase_txid; + let mut coinbase_txid_le = coinbase_txid.to_vec(); coinbase_txid_le.reverse(); let coinbase_txid = hex::encode(coinbase_txid_le); @@ -989,10 +990,10 @@ fn main() { append_to_file("../output.txt", &serialized_cb_tx).unwrap(); // to test block weight - let half_txid = sorted_txids.len() /2; + //let half_txid = sorted_txids.len() /2; // Add the txids to the block - for txid in &sorted_txids[0..half_txid] { + for txid in &sorted_txids { append_to_file("../output.txt", txid).unwrap(); } println!("Success, the block met the target difficulty!");