From eb8d3999855f364248943a3f12e99d408165f43b Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 28 Feb 2020 12:18:57 +0800 Subject: [PATCH] Merge #18209: test: Reduce unneeded whitelist permissions in tests fa45d606461dbf5bf1017d6ab15e89c1bcf821a6 test: Reduce unneeded whitelist permissions in tests (MarcoFalke) Pull request description: It makes the tests confusing and fragile when overwriting default command line values that are not needed to be overwritten. ACKs for top commit: fanquake: ACK fa45d606461dbf5bf1017d6ab15e89c1bcf821a6 laanwj: ACK fa45d606461dbf5bf1017d6ab15e89c1bcf821a6 Tree-SHA512: 8ae5ad8c6be156b1a983adccbca8d868ef841e00605ea88e24227f1b7493987c50b3e62e68dd7dc785ad73d6e14279eb13d7a151cb0a976426fe2fd63ce5cbcd --- test/functional/feature_cltv.py | 2 +- test/functional/feature_csv_activation.py | 6 +++++- test/functional/feature_dersig.py | 2 +- test/functional/feature_fee_estimation.py | 6 +++--- test/functional/feature_maxuploadtarget.py | 5 ++--- test/functional/p2p_invalid_block.py | 2 +- test/functional/rpc_fundrawtransaction.py | 2 +- test/functional/wallet_avoidreuse.py | 2 +- test/functional/wallet_backup.py | 8 ++++---- 9 files changed, 19 insertions(+), 16 deletions(-) diff --git a/test/functional/feature_cltv.py b/test/functional/feature_cltv.py index 9eb7348622..a1bcc3b1aa 100755 --- a/test/functional/feature_cltv.py +++ b/test/functional/feature_cltv.py @@ -60,7 +60,7 @@ class BIP65Test(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 self.extra_args = [[ - '-whitelist=127.0.0.1', + '-whitelist=noban@127.0.0.1', '-dip3params=9000:9000', '-par=1', # Use only one script thread to get the exact reject reason for testing '-acceptnonstdtxn=1', # cltv_invalidate is nonstandard diff --git a/test/functional/feature_csv_activation.py b/test/functional/feature_csv_activation.py index 2409579db7..31c0d7acd7 100755 --- a/test/functional/feature_csv_activation.py +++ b/test/functional/feature_csv_activation.py @@ -144,7 +144,11 @@ class BIP68_112_113Test(BitcoinTestFramework): self.setup_clean_chain = True # Must also set '-maxtipage=600100' to allow syncing from very old blocks # and '-dip3params=2000:2000' to create pre-dip3 blocks only - self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=4', '-maxtipage=600100', '-dip3params=2000:2000']] + self.extra_args = [[ + '-whitelist=noban@127.0.0.1', + '-blockversion=4', + '-maxtipage=600100', '-dip3params=2000:2000', + ]] self.supports_cli = False def setup_network(self): diff --git a/test/functional/feature_dersig.py b/test/functional/feature_dersig.py index 331e76b324..ab47d73865 100755 --- a/test/functional/feature_dersig.py +++ b/test/functional/feature_dersig.py @@ -45,7 +45,7 @@ def unDERify(tx): class BIP66Test(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 - self.extra_args = [['-whitelist=127.0.0.1', '-dip3params=9000:9000', '-par=1', '-enablebip61']] # Use only one script thread to get the exact reject reason for testing + self.extra_args = [['-whitelist=noban@127.0.0.1', '-dip3params=9000:9000', '-par=1', '-enablebip61']] # Use only one script thread to get the exact reject reason for testing self.setup_clean_chain = True self.rpc_timeout = 240 diff --git a/test/functional/feature_fee_estimation.py b/test/functional/feature_fee_estimation.py index 54e92320cc..a6b01e8fd8 100755 --- a/test/functional/feature_fee_estimation.py +++ b/test/functional/feature_fee_estimation.py @@ -125,9 +125,9 @@ class EstimateFeeTest(BitcoinTestFramework): self.num_nodes = 3 # mine non-standard txs (e.g. txs with "dust" outputs) self.extra_args = [ - ["-acceptnonstdtxn=1", "-maxorphantxsize=1000", "-whitelist=127.0.0.1"], - ["-acceptnonstdtxn=1", "-blockmaxsize=17000", "-maxorphantxsize=1000", "-whitelist=127.0.0.1"], - ["-acceptnonstdtxn=1", "-blockmaxsize=8000", "-maxorphantxsize=1000", "-whitelist=127.0.0.1"] + ["-acceptnonstdtxn=1", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1"], + ["-acceptnonstdtxn=1", "-blockmaxsize=17000", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1"], + ["-acceptnonstdtxn=1", "-blockmaxsize=8000", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1"] ] def skip_test_if_missing_module(self): diff --git a/test/functional/feature_maxuploadtarget.py b/test/functional/feature_maxuploadtarget.py index b071782287..067dd4db84 100755 --- a/test/functional/feature_maxuploadtarget.py +++ b/test/functional/feature_maxuploadtarget.py @@ -145,10 +145,9 @@ class MaxUploadTest(BitcoinTestFramework): self.nodes[0].disconnect_p2ps() - #stop and start node 0 with 1MB maxuploadtarget, whitelist 127.0.0.1 - self.log.info("Restarting nodes with -whitelist=127.0.0.1") + self.log.info("Restarting node 0 with noban permission and 1MB maxuploadtarget") self.stop_node(0) - self.start_node(0, ["-whitelist=127.0.0.1", "-maxuploadtarget=1", "-blockmaxsize=999000", "-maxtipage="+str(2*60*60*24*7), "-mocktime="+str(current_mocktime)]) + self.start_node(0, ["-whitelist=noban@127.0.0.1", "-maxuploadtarget=1", "-blockmaxsize=999000", "-maxtipage="+str(2*60*60*24*7), "-mocktime="+str(current_mocktime)]) # Reconnect to self.nodes[0] self.nodes[0].add_p2p_connection(TestP2PConn()) diff --git a/test/functional/p2p_invalid_block.py b/test/functional/p2p_invalid_block.py index 65f90ec5a3..1a5cdb2baa 100755 --- a/test/functional/p2p_invalid_block.py +++ b/test/functional/p2p_invalid_block.py @@ -23,7 +23,7 @@ class InvalidBlockRequestTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 self.setup_clean_chain = True - self.extra_args = [["-whitelist=127.0.0.1"]] + self.extra_args = [["-whitelist=noban@127.0.0.1"]] def run_test(self): # Add p2p connection to node0 diff --git a/test/functional/rpc_fundrawtransaction.py b/test/functional/rpc_fundrawtransaction.py index 4bdb40f22a..8753cf7d4e 100755 --- a/test/functional/rpc_fundrawtransaction.py +++ b/test/functional/rpc_fundrawtransaction.py @@ -30,7 +30,7 @@ class RawTransactionsTest(BitcoinTestFramework): self.extra_args = [['-usehd=0']] * self.num_nodes # This test isn't testing tx relay. Set whitelist on the peers for # instant tx relay. - self.extra_args = [['-whitelist=127.0.0.1']] * self.num_nodes + self.extra_args = [['-whitelist=noban@127.0.0.1']] * self.num_nodes def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/wallet_avoidreuse.py b/test/functional/wallet_avoidreuse.py index 47d16c35a0..63fec49c3e 100755 --- a/test/functional/wallet_avoidreuse.py +++ b/test/functional/wallet_avoidreuse.py @@ -75,7 +75,7 @@ class AvoidReuseTest(BitcoinTestFramework): self.num_nodes = 2 # This test isn't testing txn relay/timing, so set whitelist on the # peers for instant txn relay. This speeds up the test run time 2-3x. - self.extra_args = [["-whitelist=127.0.0.1"]] * self.num_nodes + self.extra_args = [["-whitelist=noban@127.0.0.1"]] * self.num_nodes def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/wallet_backup.py b/test/functional/wallet_backup.py index e2802e515d..914691ac43 100755 --- a/test/functional/wallet_backup.py +++ b/test/functional/wallet_backup.py @@ -45,10 +45,10 @@ class WalletBackupTest(BitcoinTestFramework): # 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 = [ - ["-keypool=100", "-whitelist=127.0.0.1"], - ["-keypool=100", "-whitelist=127.0.0.1"], - ["-keypool=100", "-whitelist=127.0.0.1"], - ["-whitelist=127.0.0.1"] + ["-whitelist=noban@127.0.0.1", "-keypool=100"], + ["-whitelist=noban@127.0.0.1", "-keypool=100"], + ["-whitelist=noban@127.0.0.1", "-keypool=100"], + ["-whitelist=noban@127.0.0.1"], ] self.rpc_timeout = 120