Skip to content

Commit 6d4a782

Browse files
knstUdjinM6
andcommitted
refactor: make dash specific args sporkkey and dip3params resilient for dashd restart
Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com>
1 parent 7eaa0cf commit 6d4a782

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
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,
@@ -635,6 +636,7 @@ def dynamically_initialize_datadir(self, node_p2p_port, node_rpc_port):
635636
f.write("upnp=0\n")
636637
f.write("natpmp=0\n")
637638
f.write("shrinkdebugfile=0\n")
639+
f.write("dip3params=2:2\n")
638640
os.makedirs(os.path.join(new_data_dir, 'stderr'), exist_ok=True)
639641
os.makedirs(os.path.join(new_data_dir, 'stdout'), exist_ok=True)
640642

@@ -1099,6 +1101,15 @@ def run_test(self):
10991101
"""Tests must override this method to define test logic"""
11001102
raise NotImplementedError
11011103

1104+
def add_nodes(self, num_nodes: int, extra_args=None, *, rpchost=None, binary=None, binary_cli=None, versions=None):
1105+
old_num_nodes = len(self.nodes)
1106+
super().add_nodes(num_nodes, extra_args, rpchost=rpchost, binary=binary, binary_cli=binary_cli, versions=versions)
1107+
for i in range(old_num_nodes, old_num_nodes + num_nodes):
1108+
append_config(self.nodes[i].datadir, ["dip3params=2:2"])
1109+
if old_num_nodes == 0:
1110+
# controller node is the only node that has an extra option allowing it to submit sporks
1111+
append_config(self.nodes[0].datadir, ["sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"])
1112+
11021113
def connect_nodes(self, a, b):
11031114
for mn2 in self.mninfo:
11041115
if mn2.node is not None:
@@ -1119,9 +1130,6 @@ def set_dash_test_params(self, num_nodes, masterodes_count, extra_args=None, evo
11191130
extra_args = [[]] * num_nodes
11201131
assert_equal(len(extra_args), num_nodes)
11211132
self.extra_args = [copy.deepcopy(a) for a in extra_args]
1122-
self.extra_args[0] += ["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"]
1123-
for i in range(0, num_nodes):
1124-
self.extra_args[i].append("-dip3params=2:2")
11251133

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

0 commit comments

Comments
 (0)