@@ -35,16 +35,6 @@ def sleep_and_assert_no_instantlock(self, txid, node, sleep=5):
3535 time .sleep (sleep )
3636 self .assert_no_instantlock (txid , node )
3737
38- # random delay before tx is actually send by network could take up to 30 seconds
39- def wait_for_tx (self , txid , node , expected = True , timeout = 60 ):
40- def check_tx ():
41- try :
42- return node .getrawtransaction (txid )
43- except Exception :
44- return False
45- if self .wait_until (check_tx , timeout = timeout , do_assert = expected ) and not expected :
46- raise AssertionError ("waiting unexpectedly succeeded" )
47-
4838 def create_fund_sign_tx (self ):
4939 rawtx = self .nodes [0 ].createrawtransaction ([], {self .nodes [0 ].getnewaddress (): 1 })
5040 rawtx = self .nodes [0 ].fundrawtransaction (rawtx )['hex' ]
@@ -67,14 +57,15 @@ def run_test(self):
6757 # 3 nodes should be enough to create an IS lock even if nodes 4 and 5 (which have no tx itself)
6858 # are the only "neighbours" in intra-quorum connections for one of them.
6959 self .bump_mocktime (30 )
60+ self .sync_mempools (self .nodes [:3 ])
7061 self .sleep_and_assert_no_instantlock (txid , self .nodes [0 ])
7162 # Have to disable ChainLocks to avoid signing a block with a "safe" tx too early
7263 self .nodes [0 ].sporkupdate ("SPORK_19_CHAINLOCKS_ENABLED" , 4000000000 )
7364 self .wait_for_sporks_same ()
7465 # We have to wait in order to include tx in block
7566 self .bump_mocktime (10 * 60 + 1 )
7667 block = self .generate (self .nodes [0 ], 1 , sync_fun = self .no_op )[0 ]
77- self .wait_for_instantlock (txid , self .nodes [0 ])
68+ self .wait_for_instantlock (txid , nodes = [ self .nodes [0 ]], skip_sync = True )
7869 self .nodes [0 ].sporkupdate ("SPORK_19_CHAINLOCKS_ENABLED" , 0 )
7970 self .wait_for_sporks_same ()
8071 self .wait_for_chainlocked_block_all_nodes (block )
@@ -87,19 +78,17 @@ def run_test(self):
8778 txid = self .nodes [0 ].sendtoaddress (self .nodes [0 ].getnewaddress (), 1 )
8879 # 3 nodes should be enough to create an IS lock even if nodes 4 and 5 (which have no tx itself)
8980 # are the only "neighbours" in intra-quorum connections for one of them.
90- self .bump_mocktime (30 )
91- self .wait_for_instantlock (txid , self .nodes [0 ])
81+ self .wait_for_instantlock (txid , nodes = self .nodes [:3 ])
9282 block = self .generate (self .nodes [0 ], 1 , sync_fun = self .no_op )[0 ]
9383 self .wait_for_chainlocked_block_all_nodes (block )
9484
9585 self .log .info ("testing normal signing with partially known TX" )
9686 self .isolate_node (3 )
9787 txid = self .nodes [0 ].sendtoaddress (self .nodes [0 ].getnewaddress (), 1 )
98- # Make sure nodes 1 and 2 received the TX before we continue,
88+ # Make sure connected nodes received the TX before we continue,
9989 # otherwise it might announce the TX to node 3 when reconnecting
10090 self .bump_mocktime (30 )
101- self .wait_for_tx (txid , self .nodes [1 ])
102- self .wait_for_tx (txid , self .nodes [2 ])
91+ self .sync_mempools (self .nodes [:3 ])
10392 self .reconnect_isolated_node (3 , 0 )
10493 # Make sure nodes actually try re-connecting quorum connections
10594 self .bump_mocktime (30 )
@@ -110,7 +99,7 @@ def run_test(self):
11099 self .nodes [3 ].sendrawtransaction (self .nodes [0 ].getrawtransaction (txid ))
111100 # node 3 should vote on a tx now since it became aware of it via sendrawtransaction
112101 # and this should be enough to complete an IS lock
113- self .wait_for_instantlock (txid , self .nodes [0 ])
102+ self .wait_for_instantlock (txid , nodes = [ self .nodes [0 ]], skip_sync = True )
114103
115104 self .log .info ("testing retroactive signing with unknown TX" )
116105 self .isolate_node (3 )
@@ -126,11 +115,10 @@ def run_test(self):
126115 self .log .info ("testing retroactive signing with partially known TX" )
127116 self .isolate_node (3 )
128117 txid = self .nodes [0 ].sendtoaddress (self .nodes [0 ].getnewaddress (), 1 )
129- # Make sure nodes 1 and 2 received the TX before we continue,
118+ # Make sure connected nodes received the TX before we continue,
130119 # otherwise it might announce the TX to node 3 when reconnecting
131120 self .bump_mocktime (30 )
132- self .wait_for_tx (txid , self .nodes [1 ])
133- self .wait_for_tx (txid , self .nodes [2 ])
121+ self .sync_mempools (self .nodes [:3 ])
134122 self .reconnect_isolated_node (3 , 0 )
135123 # Make sure nodes actually try re-connecting quorum connections
136124 self .bump_mocktime (30 )
@@ -159,10 +147,9 @@ def test_session_timeout(self, do_cycle_llmqs):
159147 rawtx_1 = self .create_fund_sign_tx ()
160148 txid_single_node = self .nodes [3 ].sendrawtransaction (rawtx_1 )
161149
162- # Make sure nodes 1 and 2 received the TX before we continue
150+ # Make sure connected nodes received the TX before we continue
163151 self .bump_mocktime (30 )
164- self .wait_for_tx (txid_all_nodes , self .nodes [1 ])
165- self .wait_for_tx (txid_all_nodes , self .nodes [2 ])
152+ self .sync_mempools (self .nodes [:3 ])
166153 # Make sure signing is done on nodes 1 and 2 (it's async)
167154 time .sleep (5 )
168155 # Make the signing session for the IS lock timeout on nodes 1-3
@@ -174,10 +161,9 @@ def test_session_timeout(self, do_cycle_llmqs):
174161 self .wait_for_mnauth (self .nodes [3 ], 2 )
175162
176163 self .nodes [0 ].sendrawtransaction (rawtx_1 )
177- # Make sure nodes 1 and 2 received the TX
164+ # Make sure connected nodes received the TX
178165 self .bump_mocktime (30 )
179- self .wait_for_tx (txid_single_node , self .nodes [1 ])
180- self .wait_for_tx (txid_single_node , self .nodes [2 ])
166+ self .sync_mempools (self .nodes [:3 ])
181167 self .bump_mocktime (30 )
182168
183169 # Make sure signing is done on nodes 1 and 2 (it's async)
0 commit comments