From 4ba6dc5a6c3492435d062090b84a2f6afcd1269d Mon Sep 17 00:00:00 2001 From: Ian Slane Date: Sat, 27 Apr 2024 21:50:10 -0600 Subject: [PATCH] cleaned up block.rs --- mine-your-first-block/src/block.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mine-your-first-block/src/block.rs b/mine-your-first-block/src/block.rs index fb9d6fd..54ce3a9 100644 --- a/mine-your-first-block/src/block.rs +++ b/mine-your-first-block/src/block.rs @@ -31,7 +31,7 @@ pub fn create_coinbase_tx(total_tx_fee: u64, witness_root_vec: Vec) -> T let txid= "0000000000000000000000000000000000000000000000000000000000000000".to_string(); // input count is 1 byte 01 coinbase_tx.vin.push(Vin { - txid: txid, + txid, vout: 0xffffffff, prevout: Prevout { scriptpubkey: "".to_string(), @@ -78,7 +78,7 @@ pub fn create_coinbase_tx(total_tx_fee: u64, witness_root_vec: Vec) -> T coinbase_tx } -// This function creates the block header struct +/// This function creates the block header struct pub fn construct_block_header(nonce: u32, merkle_root: String) -> BlockHeader { let mut block_header = BlockHeader{ @@ -103,8 +103,6 @@ pub fn construct_block_header(nonce: u32, merkle_root: String) -> BlockHeader { block_header.timestamp = timestamp as u32; // Nonce - // 4 byte little endian unsigned integer - // I guess start nonce at 0 and increment until the block hash is less than the target block_header.nonce = nonce; // pass in a nonce from main block_header