@@ -174,6 +174,9 @@ def on_wtxidrelay(self, message):
174
174
self .last_wtxidrelay .append (message )
175
175
176
176
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 )
177
180
with mininode_lock :
178
181
self .last_message .pop ("getdata" , None )
179
182
if use_wtxid :
@@ -259,6 +262,8 @@ def run_test(self):
259
262
self .old_node = self .nodes [0 ].add_p2p_connection (TestP2PConn (), services = NODE_NETWORK )
260
263
# self.std_node is for testing node1 (fRequireStandard=true)
261
264
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 )
262
267
263
268
assert self .test_node .nServices & NODE_WITNESS != 0
264
269
@@ -1320,10 +1325,13 @@ def test_tx_relay_after_segwit_activation(self):
1320
1325
tx3 .rehash ()
1321
1326
1322
1327
# Node will not be blinded to the transaction, requesting it any number of times
1323
- # since it is being announced via txid relay.
1328
+ # if it is being announced via txid relay.
1329
+ # Node will be blinded to the transaction via wtxid, however.
1324
1330
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 )
1325
1332
test_transaction_acceptance (self .nodes [1 ], self .std_node , tx3 , True , False , 'tx-size' )
1326
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 )
1327
1335
1328
1336
# Remove witness stuffing, instead add extra witness push on stack
1329
1337
tx3 .vout [0 ] = CTxOut (tx2 .vout [0 ].nValue - 1000 , CScript ([OP_TRUE , OP_DROP ] * 15 + [OP_TRUE ]))
0 commit comments