Skip to content

Commit 214e665

Browse files
committed
Merge #19649: Restore test case for p2p transaction blinding
566aada Test that wtxid relay peers add wtxid to reject filter (Gregory Sanders) 0fea6ed Restore test case for p2p transaction blinding (Gregory Sanders) Pull request description: Introduced in ca10a03 then erroneously removed in 8d8099e. The restored line is how we are checking that the node will still re-request a specific txid given a witness-related failure. ACKs for top commit: fjahr: tACK 566aada Tree-SHA512: be2b75b5eddb88019b79cc798f9922ca7347ccbb2210b8d4eae93fdde62e2cbb614b5247cb2fbd7ee3577dbe053875a9b62c5747aace8617f12790b8fccdeab4
2 parents b75f2ad + 566aada commit 214e665

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/functional/p2p_segwit.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ def on_wtxidrelay(self, message):
174174
self.last_wtxidrelay.append(message)
175175

176176
def announce_tx_and_wait_for_getdata(self, tx, timeout=60, success=True, use_wtxid=False):
177+
if success:
178+
# sanity check
179+
assert (self.wtxidrelay and use_wtxid) or (not self.wtxidrelay and not use_wtxid)
177180
with mininode_lock:
178181
self.last_message.pop("getdata", None)
179182
if use_wtxid:
@@ -259,6 +262,8 @@ def run_test(self):
259262
self.old_node = self.nodes[0].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK)
260263
# self.std_node is for testing node1 (fRequireStandard=true)
261264
self.std_node = self.nodes[1].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK | NODE_WITNESS)
265+
# self.std_wtx_node is for testing node1 with wtxid relay
266+
self.std_wtx_node = self.nodes[1].add_p2p_connection(TestP2PConn(wtxidrelay=True), services=NODE_NETWORK | NODE_WITNESS)
262267

263268
assert self.test_node.nServices & NODE_WITNESS != 0
264269

@@ -1319,9 +1324,14 @@ def test_tx_relay_after_segwit_activation(self):
13191324
tx3.wit.vtxinwit[0].scriptWitness.stack = [witness_program2]
13201325
tx3.rehash()
13211326

1322-
# Node will not be blinded to the transaction
1327+
# Node will not be blinded to the transaction, requesting it any number of times
1328+
# if it is being announced via txid relay.
1329+
# Node will be blinded to the transaction via wtxid, however.
13231330
self.std_node.announce_tx_and_wait_for_getdata(tx3)
1331+
self.std_wtx_node.announce_tx_and_wait_for_getdata(tx3, use_wtxid=True)
13241332
test_transaction_acceptance(self.nodes[1], self.std_node, tx3, True, False, 'tx-size')
1333+
self.std_node.announce_tx_and_wait_for_getdata(tx3)
1334+
self.std_wtx_node.announce_tx_and_wait_for_getdata(tx3, use_wtxid=True, success=False)
13251335

13261336
# Remove witness stuffing, instead add extra witness push on stack
13271337
tx3.vout[0] = CTxOut(tx2.vout[0].nValue - 1000, CScript([OP_TRUE, OP_DROP] * 15 + [OP_TRUE]))

0 commit comments

Comments
 (0)