mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge #6283: fix: do not use extra_args for enforced DashTestFramework arguments
6d4a782756
refactor: make dash specific args `sporkkey` and `dip3params` resilient for dashd restart (Konstantin Akimov)7eaa0cf9ca
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](c28b05c5ca
) 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: utACK6d4a782756
PastaPastaPasta: utACK6d4a782756
Tree-SHA512: 638b2dfe45aa35d7a9c9b4e527c3211b47e8f2fc97caf130eae09ee348d539b4c73007be0e3949ac978e306d394d9ead1d63bda3f4b515335cc62c32d2635e62
This commit is contained in:
commit
dc02da1b28
@ -311,7 +311,7 @@ class NetTest(DashTestFramework):
|
||||
by first testing adding a tried table entry before testing adding a new table one.
|
||||
"""
|
||||
self.log.info("Test addpeeraddress")
|
||||
self.restart_node(1, self.extra_args[1] + ["-checkaddrman=1"])
|
||||
self.restart_node(1, ["-checkaddrman=1"])
|
||||
node = self.nodes[1]
|
||||
|
||||
self.log.debug("Test that addpeerinfo is a hidden RPC")
|
||||
|
@ -43,6 +43,7 @@ from .test_node import TestNode
|
||||
from .util import (
|
||||
PortSeed,
|
||||
MAX_NODES,
|
||||
append_config,
|
||||
assert_equal,
|
||||
check_json_precision,
|
||||
copy_datadir,
|
||||
@ -634,6 +635,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
f.write("upnp=0\n")
|
||||
f.write("natpmp=0\n")
|
||||
f.write("shrinkdebugfile=0\n")
|
||||
f.write("dip3params=2:2\n")
|
||||
os.makedirs(os.path.join(new_data_dir, 'stderr'), exist_ok=True)
|
||||
os.makedirs(os.path.join(new_data_dir, 'stdout'), exist_ok=True)
|
||||
|
||||
@ -1150,6 +1152,15 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
"""Tests must override this method to define test logic"""
|
||||
raise NotImplementedError
|
||||
|
||||
def add_nodes(self, num_nodes: int, extra_args=None, *, rpchost=None, binary=None, binary_cli=None, versions=None):
|
||||
old_num_nodes = len(self.nodes)
|
||||
super().add_nodes(num_nodes, extra_args, rpchost=rpchost, binary=binary, binary_cli=binary_cli, versions=versions)
|
||||
for i in range(old_num_nodes, old_num_nodes + num_nodes):
|
||||
append_config(self.nodes[i].datadir, ["dip3params=2:2"])
|
||||
if old_num_nodes == 0:
|
||||
# controller node is the only node that has an extra option allowing it to submit sporks
|
||||
append_config(self.nodes[0].datadir, ["sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"])
|
||||
|
||||
def connect_nodes(self, a, b):
|
||||
for mn2 in self.mninfo:
|
||||
if mn2.node is not None:
|
||||
@ -1170,9 +1181,6 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
extra_args = [[]] * num_nodes
|
||||
assert_equal(len(extra_args), num_nodes)
|
||||
self.extra_args = [copy.deepcopy(a) for a in extra_args]
|
||||
self.extra_args[0] += ["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"]
|
||||
for i in range(0, num_nodes):
|
||||
self.extra_args[i].append("-dip3params=2:2")
|
||||
|
||||
# LLMQ default test params (no need to pass -llmqtestparams)
|
||||
self.llmq_size = 3
|
||||
|
@ -13,7 +13,6 @@ class WalletMnemonicbitsTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [['-usehd=1']]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
@ -23,18 +22,18 @@ class WalletMnemonicbitsTest(BitcoinTestFramework):
|
||||
|
||||
self.log.info("Invalid -mnemonicbits should rise an error")
|
||||
self.stop_node(0)
|
||||
self.nodes[0].assert_start_raises_init_error(self.extra_args[0] + ['-mnemonicbits=123'], "Error: Invalid '-mnemonicbits'. Allowed values: 128, 160, 192, 224, 256.")
|
||||
self.nodes[0].assert_start_raises_init_error(['-mnemonicbits=123'], "Error: Invalid '-mnemonicbits'. Allowed values: 128, 160, 192, 224, 256.")
|
||||
self.start_node(0)
|
||||
assert_equal(len(self.nodes[0].dumphdinfo()["mnemonic"].split()), 12) # 12 words by default
|
||||
|
||||
self.log.info("Can have multiple wallets with different mnemonic length loaded at the same time")
|
||||
self.restart_node(0, extra_args=self.extra_args[0] + ["-mnemonicbits=160"])
|
||||
self.restart_node(0, extra_args=["-mnemonicbits=160"])
|
||||
self.nodes[0].createwallet("wallet_160")
|
||||
self.restart_node(0, extra_args=self.extra_args[0] + ["-mnemonicbits=192"])
|
||||
self.restart_node(0, extra_args=["-mnemonicbits=192"])
|
||||
self.nodes[0].createwallet("wallet_192")
|
||||
self.restart_node(0, extra_args=self.extra_args[0] + ["-mnemonicbits=224"])
|
||||
self.restart_node(0, extra_args=["-mnemonicbits=224"])
|
||||
self.nodes[0].createwallet("wallet_224")
|
||||
self.restart_node(0, extra_args=self.extra_args[0] + ["-mnemonicbits=256"])
|
||||
self.restart_node(0, extra_args=["-mnemonicbits=256"])
|
||||
self.nodes[0].loadwallet("wallet_160")
|
||||
self.nodes[0].loadwallet("wallet_192")
|
||||
self.nodes[0].loadwallet("wallet_224")
|
||||
|
Loading…
Reference in New Issue
Block a user