tests: Add witness commitment if we have a witness transaction in FullBlockTest.update_block()

This commit is contained in:
Chris Stewart committed 2025-11-14 18:43:21 -06:00
1 parent e221b25246
commit a7c96f874d
2 files changed
+20

No files matched your search

+4
View File
@@ -7,6 +7,7 @@ import copy
import time
from test_framework.blocktools import (
add_witness_commitment,
create_block,
create_coinbase,
create_tx_with_script,
@@ -1416,6 +1417,9 @@ class FullBlockTest(BitcoinTestFramework):
if nTime is not None:
block.nTime = nTime
block.hashMerkleRoot = block.calc_merkle_root()
has_witness_tx = any(not tx.wit.is_null() for tx in block.vtx)
if has_witness_tx:
add_witness_commitment(block)
block.solve()
# Update the internal state just like in next_block
self.tip = block