From e755c83a9db0a7c1fd7f33befc3b49e950514062 Mon Sep 17 00:00:00 2001 From: Nithish Karthik Date: Fri, 12 Apr 2024 01:18:59 +0530 Subject: [PATCH] add witness hash only for txns with witness --- src/mining/coinbase.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mining/coinbase.go b/src/mining/coinbase.go index eec2369..4128c46 100644 --- a/src/mining/coinbase.go +++ b/src/mining/coinbase.go @@ -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()))) } }