mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-30 05:52:33 +02:00
[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 https://github.com/bitcoin/bitcoin/pull/20799#discussion_r867782119
This commit is contained in:
parent
c65bf50b44
commit
bf6526f4a0
@ -146,10 +146,8 @@ class CompactBlocksTest(BitcoinTestFramework):
|
|||||||
]]
|
]]
|
||||||
self.utxos = []
|
self.utxos = []
|
||||||
|
|
||||||
def build_block_on_tip(self, node, segwit=False):
|
def build_block_on_tip(self, node):
|
||||||
block = create_block(tmpl=node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS))
|
block = create_block(tmpl=node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS))
|
||||||
if segwit:
|
|
||||||
add_witness_commitment(block)
|
|
||||||
block.solve()
|
block.solve()
|
||||||
return block
|
return block
|
||||||
|
|
||||||
@ -381,7 +379,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
|||||||
# Try announcing a block with an inv or header, expect a compactblock
|
# Try announcing a block with an inv or header, expect a compactblock
|
||||||
# request
|
# request
|
||||||
for announce in ["inv", "header"]:
|
for announce in ["inv", "header"]:
|
||||||
block = self.build_block_on_tip(node, segwit=True)
|
block = self.build_block_on_tip(node)
|
||||||
|
|
||||||
if announce == "inv":
|
if announce == "inv":
|
||||||
test_node.send_message(msg_inv([CInv(MSG_BLOCK, block.sha256)]))
|
test_node.send_message(msg_inv([CInv(MSG_BLOCK, block.sha256)]))
|
||||||
|
Loading…
Reference in New Issue
Block a user