Skip to content

Commit dc02da1

Browse files
Merge #6283: fix: do not use extra_args for enforced DashTestFramework arguments
6d4a782 refactor: make dash specific args `sporkkey` and `dip3params` resilient for dashd restart (Konstantin Akimov) 7eaa0cf refactor: simplify extra arguments wallet_mnemonicbits.py since usehd=1 is default option (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented DashTestFramework requires 2 arguments for dashd which are lost every dashd restart: `sporkkey` and `dip3params`. Without this PR you need to pass this arguments manually every time when you restart dashd in functional tests. ## What was done? Make dash specific args `sporkkey` and `dip3params` resilient for dashd restart It makes workarounds such as [these](c28b05c) no more needed: ``` self.restart_node(1, self.extra_args[1] + ["-checkaddrman=1"]) ``` Also there's some cleanup for `wallet_mnemonicbits.py` to remove `usehd=1` which is not required, and it has been discovered during revising all node's restarts related code. ## How Has This Been Tested? Removed workaround from `rpc_net.py` and run functional tests ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: utACK 6d4a782 PastaPastaPasta: utACK 6d4a782 Tree-SHA512: 638b2dfe45aa35d7a9c9b4e527c3211b47e8f2fc97caf130eae09ee348d539b4c73007be0e3949ac978e306d394d9ead1d63bda3f4b515335cc62c32d2635e62
2 parents 3f0c2ff + 6d4a782 commit dc02da1

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

test/functional/rpc_net.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def test_addpeeraddress(self):
311311
by first testing adding a tried table entry before testing adding a new table one.
312312
"""
313313
self.log.info("Test addpeeraddress")
314-
self.restart_node(1, self.extra_args[1] + ["-checkaddrman=1"])
314+
self.restart_node(1, ["-checkaddrman=1"])
315315
node = self.nodes[1]
316316

317317
self.log.debug("Test that addpeerinfo is a hidden RPC")

test/functional/test_framework/test_framework.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from .util import (
4444
PortSeed,
4545
MAX_NODES,
46+
append_config,
4647
assert_equal,
4748
check_json_precision,
4849
copy_datadir,
@@ -634,6 +635,7 @@ def dynamically_initialize_datadir(self, node_p2p_port, node_rpc_port):
634635
f.write("upnp=0\n")
635636
f.write("natpmp=0\n")
636637
f.write("shrinkdebugfile=0\n")
638+
f.write("dip3params=2:2\n")
637639
os.makedirs(os.path.join(new_data_dir, 'stderr'), exist_ok=True)
638640
os.makedirs(os.path.join(new_data_dir, 'stdout'), exist_ok=True)
639641

@@ -1150,6 +1152,15 @@ def run_test(self):
11501152
"""Tests must override this method to define test logic"""
11511153
raise NotImplementedError
11521154

1155+
def add_nodes(self, num_nodes: int, extra_args=None, *, rpchost=None, binary=None, binary_cli=None, versions=None):
1156+
old_num_nodes = len(self.nodes)
1157+
super().add_nodes(num_nodes, extra_args, rpchost=rpchost, binary=binary, binary_cli=binary_cli, versions=versions)
1158+
for i in range(old_num_nodes, old_num_nodes + num_nodes):
1159+
append_config(self.nodes[i].datadir, ["dip3params=2:2"])
1160+
if old_num_nodes == 0:
1161+
# controller node is the only node that has an extra option allowing it to submit sporks
1162+
append_config(self.nodes[0].datadir, ["sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"])
1163+
11531164
def connect_nodes(self, a, b):
11541165
for mn2 in self.mninfo:
11551166
if mn2.node is not None:
@@ -1170,9 +1181,6 @@ def set_dash_test_params(self, num_nodes, masterodes_count, extra_args=None, evo
11701181
extra_args = [[]] * num_nodes
11711182
assert_equal(len(extra_args), num_nodes)
11721183
self.extra_args = [copy.deepcopy(a) for a in extra_args]
1173-
self.extra_args[0] += ["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"]
1174-
for i in range(0, num_nodes):
1175-
self.extra_args[i].append("-dip3params=2:2")
11761184

11771185
# LLMQ default test params (no need to pass -llmqtestparams)
11781186
self.llmq_size = 3

test/functional/wallet_mnemonicbits.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class WalletMnemonicbitsTest(BitcoinTestFramework):
1313
def set_test_params(self):
1414
self.setup_clean_chain = True
1515
self.num_nodes = 1
16-
self.extra_args = [['-usehd=1']]
1716

1817
def skip_test_if_missing_module(self):
1918
self.skip_if_no_wallet()
@@ -23,18 +22,18 @@ def run_test(self):
2322

2423
self.log.info("Invalid -mnemonicbits should rise an error")
2524
self.stop_node(0)
26-
self.nodes[0].assert_start_raises_init_error(self.extra_args[0] + ['-mnemonicbits=123'], "Error: Invalid '-mnemonicbits'. Allowed values: 128, 160, 192, 224, 256.")
25+
self.nodes[0].assert_start_raises_init_error(['-mnemonicbits=123'], "Error: Invalid '-mnemonicbits'. Allowed values: 128, 160, 192, 224, 256.")
2726
self.start_node(0)
2827
assert_equal(len(self.nodes[0].dumphdinfo()["mnemonic"].split()), 12) # 12 words by default
2928

3029
self.log.info("Can have multiple wallets with different mnemonic length loaded at the same time")
31-
self.restart_node(0, extra_args=self.extra_args[0] + ["-mnemonicbits=160"])
30+
self.restart_node(0, extra_args=["-mnemonicbits=160"])
3231
self.nodes[0].createwallet("wallet_160")
33-
self.restart_node(0, extra_args=self.extra_args[0] + ["-mnemonicbits=192"])
32+
self.restart_node(0, extra_args=["-mnemonicbits=192"])
3433
self.nodes[0].createwallet("wallet_192")
35-
self.restart_node(0, extra_args=self.extra_args[0] + ["-mnemonicbits=224"])
34+
self.restart_node(0, extra_args=["-mnemonicbits=224"])
3635
self.nodes[0].createwallet("wallet_224")
37-
self.restart_node(0, extra_args=self.extra_args[0] + ["-mnemonicbits=256"])
36+
self.restart_node(0, extra_args=["-mnemonicbits=256"])
3837
self.nodes[0].loadwallet("wallet_160")
3938
self.nodes[0].loadwallet("wallet_192")
4039
self.nodes[0].loadwallet("wallet_224")

0 commit comments

Comments
 (0)