Skip to content

Commit

Permalink
tried sorting first
Browse files Browse the repository at this point in the history
  • Loading branch information
slanesuke committed Apr 21, 2024
1 parent fe805cd commit 33836fe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mine-your-first-block/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,9 @@ fn main() {
total_fees += tx.fee;
}

// Sorting the transactions from fees in desencding order
block_txs.sort_by(|a, b| b.fee.cmp(&a.fee));

// Get the wtxids for the witness root
let mut wtx_ids_for_witness_root = vec!["0000000000000000000000000000000000000000000000000000000000000000".to_string()];
for tx in &block_txs {
Expand Down Expand Up @@ -1408,7 +1411,7 @@ fn main() {
}
// Calculate the merkle root
let merkle_root = get_merkle_root(txids_for_merkle.clone());
//println!("Merkle Root: {}", merkle_root);
println!("Merkle Root: {}", merkle_root);


// Start Mining!
Expand Down

0 comments on commit 33836fe

Please sign in to comment.