Skip to content

Commit 9c64d6c

Browse files
committed
test: add helper create_fund_sign_tx for feature_llmq_is_retroactive.py
1 parent b91007b commit 9c64d6c

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

test/functional/feature_llmq_is_retroactive.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ def check_tx():
3434
if self.wait_until(check_tx, timeout=timeout, do_assert=expected) and not expected:
3535
raise AssertionError("waiting unexpectedly succeeded")
3636

37+
def create_fund_sign_tx(self):
38+
rawtx = self.nodes[0].createrawtransaction([], {self.nodes[0].getnewaddress(): 1})
39+
rawtx = self.nodes[0].fundrawtransaction(rawtx)['hex']
40+
rawtx = self.nodes[0].signrawtransactionwithwallet(rawtx)['hex']
41+
return rawtx
42+
3743
def run_test(self):
3844
self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0)
3945
# Turn mempool IS signing off
@@ -97,9 +103,7 @@ def run_test(self):
97103

98104
self.log.info("testing retroactive signing with unknown TX")
99105
self.isolate_node(3)
100-
rawtx = self.nodes[0].createrawtransaction([], {self.nodes[0].getnewaddress(): 1})
101-
rawtx = self.nodes[0].fundrawtransaction(rawtx)['hex']
102-
rawtx = self.nodes[0].signrawtransactionwithwallet(rawtx)['hex']
106+
rawtx = self.create_fund_sign_tx()
103107
txid = self.nodes[3].sendrawtransaction(rawtx)
104108
# Make node 3 consider the TX as safe
105109
self.bump_mocktime(10 * 60 + 1)
@@ -137,16 +141,11 @@ def run_test(self):
137141
def test_session_timeout(self, do_cycle_llmqs):
138142
set_node_times(self.nodes, self.mocktime)
139143
self.isolate_node(3)
140-
rawtx = self.nodes[0].createrawtransaction([], {self.nodes[0].getnewaddress(): 1})
141-
rawtx = self.nodes[0].fundrawtransaction(rawtx)['hex']
142-
rawtx = self.nodes[0].signrawtransactionwithwallet(rawtx)['hex']
144+
rawtx = self.create_fund_sign_tx()
143145
txid_all_nodes = self.nodes[0].sendrawtransaction(rawtx)
144146
txid_all_nodes = self.nodes[3].sendrawtransaction(rawtx)
145147

146-
147-
rawtx_1 = self.nodes[0].createrawtransaction([], {self.nodes[0].getnewaddress(): 1})
148-
rawtx_1 = self.nodes[0].fundrawtransaction(rawtx_1)['hex']
149-
rawtx_1 = self.nodes[0].signrawtransactionwithwallet(rawtx_1)['hex']
148+
rawtx_1 = self.create_fund_sign_tx()
150149
txid_single_node = self.nodes[3].sendrawtransaction(rawtx_1)
151150

152151
# Make sure nodes 1 and 2 received the TX before we continue

0 commit comments

Comments
 (0)