Skip to content

Commit

Permalink
added the coinbase in the loop on accident
Browse files Browse the repository at this point in the history
  • Loading branch information
slanesuke committed Apr 15, 2024
1 parent b8a5660 commit e1c8241
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions mine-your-first-block/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,18 +953,17 @@ fn main() {
// Get txids from sorted valid txs
let mut sorted_txids : Vec<String> = sorted_valid_tx.iter().map(|tx| tx.txid.clone()).collect();

// Start Mining!
loop {
// Generate coinbase tx
let coinbase_tx = create_coinbase_tx(total_fees);
let serialized_cb_tx = serialize_tx(&coinbase_tx);

// coinbase txid
let coinbase_txid = double_sha256(serialized_cb_tx.as_bytes().to_vec());
// Generate coinbase tx
let coinbase_tx = create_coinbase_tx(total_fees);
let serialized_cb_tx = serialize_tx(&coinbase_tx);

// Insert the coinbase txid at the beginning of the valid_txids vector
sorted_txids.insert(0, hex::encode(coinbase_txid));
// coinbase txid
let coinbase_txid = double_sha256(serialized_cb_tx.as_bytes().to_vec());

// Insert the coinbase txid at the beginning of the valid_txids vector
sorted_txids.insert(0, hex::encode(coinbase_txid));
// Start Mining!
loop {
// Get the block header and serialize it
let block_header = construct_block_header(sorted_txids.clone(), nonce);

Expand Down

0 comments on commit e1c8241

Please sign in to comment.