Skip to content

Commit bf6526f

Browse files
committed
[test] Remove segwit argument from build_block_on_tip()
The only place that segwit=True is for a block that contains only the coinbase transaction. Since the witness commitment is optional if none of the transactions have a witness, we can leave it out. This doesn't change the test coverage, which is testing p2p compact block logic. Suggested in bitcoin/bitcoin#20799 (comment)
1 parent c65bf50 commit bf6526f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

test/functional/p2p_compactblocks.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,8 @@ def set_test_params(self):
146146
]]
147147
self.utxos = []
148148

149-
def build_block_on_tip(self, node, segwit=False):
149+
def build_block_on_tip(self, node):
150150
block = create_block(tmpl=node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS))
151-
if segwit:
152-
add_witness_commitment(block)
153151
block.solve()
154152
return block
155153

@@ -381,7 +379,7 @@ def test_compactblock_requests(self, test_node):
381379
# Try announcing a block with an inv or header, expect a compactblock
382380
# request
383381
for announce in ["inv", "header"]:
384-
block = self.build_block_on_tip(node, segwit=True)
382+
block = self.build_block_on_tip(node)
385383

386384
if announce == "inv":
387385
test_node.send_message(msg_inv([CInv(MSG_BLOCK, block.sha256)]))

0 commit comments

Comments
 (0)