forked from ElementsProject/elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #20034: test: Get rid of default wallet hacks
c1585bc test: Get rid of default wallet hacks (Russell Yanofsky) ed3acda test, refactor: add default_wallet_name and wallet_data_filename variables (Russell Yanofsky) Pull request description: Changes: - Get rid of setup_nodes (`-wallet`, `-nowallet`, `-disablewallet`) argument rewriting - Get rid of hardcoded wallet `""` names and `-wallet=""` args Motivation: - Simplify test framework behavior so it's easier to write new tests without having arguments mangled by the framework - Make tests more readable, replacing unexplained `""` string literals with `default_wallet_name` references - Make it trivial to update default wallet name and wallet data filename for sqlite #19077 testing - Stop relying on `-wallet` arguments to create wallets, so it is easy to change `-wallet` option in the future to only load existing wallets not create new ones (to avoid accidental wallet creation, and encourage use of wallet encryption and descriptor features) ACKs for top commit: MarcoFalke: ACK c1585bc, only effective change is adding documentation 🎵 Tree-SHA512: f62dec7cbdacb5f330aa0e1eec89ab4d065540d91495bbedcb375eda1c080b45ce9edb310ce253c44c4839f1b4cc2c7df9816c58402d5d43f94a437e301ea8bc
- Loading branch information
Showing
27 changed files
with
94 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,9 +145,9 @@ def set_test_params(self): | |
# mine non-standard txs (e.g. txs with "dust" outputs) | ||
# Force fSendTrickle to true (via whitelist.noban) | ||
self.extra_args = [ | ||
["-acceptnonstdtxn", "[email protected]", "-wallet="], | ||
["-acceptnonstdtxn", "[email protected]", "-blockmaxweight=68000", "-wallet="], | ||
["-acceptnonstdtxn", "[email protected]", "-blockmaxweight=32000", "-wallet="], | ||
["-acceptnonstdtxn", "[email protected]"], | ||
["-acceptnonstdtxn", "[email protected]", "-blockmaxweight=68000"], | ||
["-acceptnonstdtxn", "[email protected]", "-blockmaxweight=32000"], | ||
] | ||
|
||
def skip_test_if_missing_module(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,10 +50,10 @@ def set_test_params(self): | |
# nodes 1, 2,3 are spenders, let's give them a keypool=100 | ||
# whitelist all peers to speed up tx relay / mempool sync | ||
self.extra_args = [ | ||
["[email protected]", "-keypool=100", "-wallet="], | ||
["[email protected]", "-keypool=100", "-wallet="], | ||
["[email protected]", "-keypool=100", "-wallet="], | ||
["[email protected]", "-wallet="], | ||
["[email protected]", "-keypool=100"], | ||
["[email protected]", "-keypool=100"], | ||
["[email protected]", "-keypool=100"], | ||
["[email protected]"], | ||
] | ||
self.rpc_timeout = 120 | ||
|
||
|
@@ -107,9 +107,9 @@ def stop_three(self): | |
self.stop_node(2) | ||
|
||
def erase_three(self): | ||
os.remove(os.path.join(self.nodes[0].datadir, self.chain, 'wallets', 'wallet.dat')) | ||
os.remove(os.path.join(self.nodes[1].datadir, self.chain, 'wallets', 'wallet.dat')) | ||
os.remove(os.path.join(self.nodes[2].datadir, self.chain, 'wallets', 'wallet.dat')) | ||
os.remove(os.path.join(self.nodes[0].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) | ||
os.remove(os.path.join(self.nodes[1].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) | ||
os.remove(os.path.join(self.nodes[2].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) | ||
|
||
def run_test(self): | ||
self.log.info("Generating initial blockchain") | ||
|
@@ -171,9 +171,9 @@ def run_test(self): | |
shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'chainstate')) | ||
|
||
# Restore wallets from backup | ||
shutil.copyfile(os.path.join(self.nodes[0].datadir, 'wallet.bak'), os.path.join(self.nodes[0].datadir, self.chain, 'wallets', 'wallet.dat')) | ||
shutil.copyfile(os.path.join(self.nodes[1].datadir, 'wallet.bak'), os.path.join(self.nodes[1].datadir, self.chain, 'wallets', 'wallet.dat')) | ||
shutil.copyfile(os.path.join(self.nodes[2].datadir, 'wallet.bak'), os.path.join(self.nodes[2].datadir, self.chain, 'wallets', 'wallet.dat')) | ||
shutil.copyfile(os.path.join(self.nodes[0].datadir, 'wallet.bak'), os.path.join(self.nodes[0].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) | ||
shutil.copyfile(os.path.join(self.nodes[1].datadir, 'wallet.bak'), os.path.join(self.nodes[1].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) | ||
shutil.copyfile(os.path.join(self.nodes[2].datadir, 'wallet.bak'), os.path.join(self.nodes[2].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) | ||
|
||
self.log.info("Re-starting nodes") | ||
self.start_three() | ||
|
@@ -209,9 +209,9 @@ def run_test(self): | |
|
||
# Backup to source wallet file must fail | ||
sourcePaths = [ | ||
os.path.join(self.nodes[0].datadir, self.chain, 'wallets', 'wallet.dat'), | ||
os.path.join(self.nodes[0].datadir, self.chain, '.', 'wallets', 'wallet.dat'), | ||
os.path.join(self.nodes[0].datadir, self.chain, 'wallets', ''), | ||
os.path.join(self.nodes[0].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename), | ||
os.path.join(self.nodes[0].datadir, self.chain, '.', 'wallets', self.default_wallet_name, self.wallet_data_filename), | ||
os.path.join(self.nodes[0].datadir, self.chain, 'wallets', self.default_wallet_name), | ||
os.path.join(self.nodes[0].datadir, self.chain, 'wallets')] | ||
|
||
for sourcePath in sourcePaths: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.