Skip to content

Commit

Permalink
add witness hash only for txns with witness
Browse files Browse the repository at this point in the history
  • Loading branch information
humblenginr committed Apr 11, 2024
1 parent b962f7b commit e755c83
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mining/coinbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ func AddWitnessCommitmentX(coinbaseTx *txn.Transaction,
// coinbase
if(t.Vin[0].IsCoinbase){
wtxids = append(wtxids, zeroHash)
} else {
} else if(t.HasWitness()) {
wtxids = append(wtxids, [32]byte(utils.ReverseBytes(t.WitnessHash())))
} else {
wtxids = append(wtxids, [32]byte(utils.ReverseBytes(t.TxHash())))
}
}

Expand Down

0 comments on commit e755c83

Please sign in to comment.