Skip to content

Commit

Permalink
changed block version
Browse files Browse the repository at this point in the history
  • Loading branch information
slanesuke committed Apr 17, 2024
1 parent 079141c commit 924b7d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mine-your-first-block/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fn create_coinbase_tx(total_tx_fee: u64) -> Transaction {
fn construct_block_header(nonce: u32, merkle_root: String) -> BlockHeader {

let mut block_header = BlockHeader{
version: 2,
version: 0x20000000,
prev_block_hash: "".to_string(),
merkle_root: merkle_root.to_string(),
timestamp: 0,
Expand Down Expand Up @@ -974,9 +974,11 @@ fn main() {

let serialized_block_header = serialize_block_header(&block_header);


// Calculate the hash of the block header
//let block_hash = calculate_hash(serialized_block_header.clone());
let block_hash = double_sha256(serialized_block_header.clone());
// I reversed the block hash and it worked soooo ???
let mut block_h = block_hash;
block_h.reverse();
let block_hash = hex::encode(block_h);
Expand Down

0 comments on commit 924b7d1

Please sign in to comment.