Skip to content

Commit

Permalink
maybe fixed coinbase serialization but cbtxid is off
Browse files Browse the repository at this point in the history
  • Loading branch information
slanesuke committed Apr 22, 2024
1 parent 2bfdff1 commit 1cd146c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mine-your-first-block/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,12 @@ fn serialized_segwit_tx(transaction: &Transaction) -> String {
let version = transaction.version.to_le_bytes();
serialized_tx.push_str(&hex::encode(version));

// For the coinbase transaction in between the version and vin count I need to add the marker and flag
// If the is_coinbase == true push 00 and 01
if transaction.vin[0].is_coinbase {
serialized_tx.push_str("0001");
}

// Serialize vin count and push the numb of inputs
let vin_count = transaction.vin.len() as u64;
serialized_tx.push_str(&format!("{:02x}", vin_count));
Expand Down

0 comments on commit 1cd146c

Please sign in to comment.