Merge bitcoin/bitcoin#36624: test: Enable noban_tx_relay in a few more tests
What changed, and why it matters
This commit only changes Bitcoin Core's internal functional test suite. It replaces manual '-whitelist=noban@127.0.0.1' settings and verbose comments with a shared test flag called 'noban_tx_relay' to make automated tests run faster. There is no change to the actual Bitcoin node software that users run, and no security vulnerability is introduced or fixed.
No action required. This is a test-only quality-of-life change with no security relevance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The merge commit updates 43 Python functional tests to consistently use the framework-provided ‘self.noban_tx_relay = True’ parameter instead of embedding ‘-whitelist=noban@127.0.0.1’ in extra_args or adding explanatory comments. This is a test-only refactoring that speeds up transaction relay during tests by disabling ban/scoring behavior for local peers. No production code, consensus logic, networking rules, or wallet behavior is modified.
Changed components
test/functional/*.py functional test suiteInspect captured patch +43 / −79
### test/functional/feature_cltv.py
@@ -81,8 +81,7 @@ def cltv_validate(tx, height):
class BIP65Test(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [[
f'-testactivationheight=cltv@{CLTV_HEIGHT}',
'-acceptnonstdtxn=1', # cltv_invalidate is nonstandard
### test/functional/feature_csv_activation.py
@@ -94,8 +94,7 @@ class BIP68_112_113Test(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.setup_clean_chain = True
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [[
f'-testactivationheight=csv@{CSV_ACTIVATION_HEIGHT}',
]]
### test/functional/feature_dersig.py
@@ -46,8 +46,7 @@ def unDERify(tx):
class BIP66Test(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [[
f'-testactivationheight=dersig@{DERSIG_HEIGHT}',
]]
### test/functional/feature_fee_estimation.py
@@ -164,8 +164,7 @@ def verify_estimate_response(estimate, feerate, errors):
class EstimateFeeTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 3
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [
[],
["-blockmaxweight=72000"],
### test/functional/feature_notifications.py
@@ -42,7 +42,7 @@ def set_test_params(self):
self.num_nodes = 2
self.setup_clean_chain = True
self.uses_wallet = None
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def setup_network(self):
self.wallet = ''.join(chr(i) for i in range(FILE_CHAR_START, FILE_CHAR_END) if chr(i) not in FILE_CHARS_DISALLOWED)
### test/functional/interface_rest.py
@@ -56,8 +56,7 @@ class RESTTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
self.extra_args = [["-rest", "-blockfilterindex=1", "-txindex"], []]
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def test_rest_request(
self,
### test/functional/interface_zmq.py
@@ -107,8 +107,7 @@ def caused_notification(self, notification):
class ZMQTest (BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.zmq_port_base = p2p_port(self.num_nodes + 1)
def skip_test_if_missing_module(self):
### test/functional/mempool_accept_wtxid.py
@@ -21,6 +21,7 @@
class MempoolWtxidTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
+ self.noban_tx_relay = True # faster tx relay
def run_test(self):
node = self.nodes[0]
### test/functional/mempool_ephemeral_dust.py
@@ -28,9 +28,7 @@ class EphemeralDustTest(BitcoinTestFramework):
def set_test_params(self):
# Mempools should match via 1P1C p2p relay
self.num_nodes = 2
-
- # Don't test trickling logic
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def add_output_to_create_multi_result(self, result, output_value=0):
""" Add output without changing absolute tx fee
### test/functional/mempool_limit.py
@@ -29,6 +29,7 @@ class MempoolLimitTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [[
"-maxmempool=5",
]]
### test/functional/mempool_package_rbf.py
@@ -31,6 +31,7 @@ class PackageRBFTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
self.setup_clean_chain = True
+ self.noban_tx_relay = True # faster tx relay
# Required for fill_mempool()
self.extra_args = [[
"-maxmempool=5",
### test/functional/mempool_packages.py
@@ -24,8 +24,7 @@
class MempoolPackagesTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [
[
],
### test/functional/mempool_persist.py
@@ -52,6 +52,7 @@
class MempoolPersistTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 3
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [[], ["-persistmempool=0"], []]
self.uses_wallet = None
### test/functional/p2p_1p1c_network.py
@@ -34,8 +34,7 @@ class PackageRelayTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 4
- # hugely speeds up the test, as it involves multiple hops of tx relay.
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def create_basic_1p1c(self, wallet):
low_fee_parent = wallet.create_self_transfer(fee_rate=0, confirmed_only=True)
### test/functional/p2p_feefilter.py
@@ -46,8 +46,7 @@ def clear_invs(self):
class FeeFilterTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
# We lower the various required feerates for this test
# to catch a corner-case where feefilter used to slightly undercut
# mempool and wallet feerate calculation based on GetFee
### test/functional/p2p_filter.py
@@ -94,8 +94,7 @@ def merkleblock_received(self, value):
class FilterTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [[
'-peerbloomfilters',
]]
### test/functional/p2p_invalid_block.py
@@ -35,8 +35,7 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.setup_clean_chain = True
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def run_test(self):
# Add p2p connection to node0
### test/functional/p2p_segwit.py
@@ -212,8 +212,7 @@ class SegWitTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
# This test tests SegWit both pre and post-activation, so use the normal BIP9 activation.
self.extra_args = [
# -par=1 should not affect validation outcome or logging/reported failures. It is kept
### test/functional/rpc_packages.py
@@ -38,8 +38,7 @@ class RPCPackagesTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.setup_clean_chain = True
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def assert_testres_equal(self, package_hex, testres_expected):
"""Shuffle package_hex and assert that the testmempoolaccept result matches testres_expected. This should only
### test/functional/rpc_psbt.py
@@ -85,9 +85,7 @@ def set_test_params(self):
["-changetype=legacy", "-maxfeerate=1"],
["-maxfeerate=1"]
]
- # whitelist peers to speed up tx relay / mempool sync
- for args in self.extra_args:
- args.append("-whitelist=noban@127.0.0.1")
+ self.noban_tx_relay = True # faster tx relay
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
### test/functional/rpc_rawtransaction.py
@@ -73,8 +73,7 @@ def set_test_params(self):
[],
["-fastprune", "-prune=1"],
]
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.supports_cli = False
def setup_network(self):
### test/functional/wallet_abandonconflict.py
@@ -24,8 +24,7 @@ class AbandonConflictTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
self.extra_args = [["-minrelaytxfee=0.00001"], []]
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
### test/functional/wallet_address_types.py
@@ -76,8 +76,7 @@ def set_test_params(self):
["-changetype=p2sh-segwit"],
[],
]
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
### test/functional/wallet_avoid_mixing_output_types.py
@@ -109,8 +109,7 @@ class AddressInputTypeGrouping(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [
[
"-addresstype=bech32",
### test/functional/wallet_avoidreuse.py
@@ -66,8 +66,7 @@ def assert_balances(node, mine, margin=0.001):
class AvoidReuseTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
### test/functional/wallet_backup.py
@@ -47,8 +47,7 @@ class WalletBackupTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
self.setup_clean_chain = True
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
# nodes 1, 2, 3 are spenders, let's give them a keypool=100
self.extra_args = [
["-keypool=100"],
### test/functional/wallet_balance.py
@@ -52,8 +52,7 @@ class WalletTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
self.setup_clean_chain = True
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [
# Limit mempool clusters as a hack to have wallet txs rejected from the mempool.
# Set walletrejectlongchains=0 so the wallet still creates the transactions.
### test/functional/wallet_basic.py
@@ -29,8 +29,7 @@
class WalletTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [[
"-dustrelayfee=0", "-walletrejectlongchains=0"
]] * self.num_nodes
### test/functional/wallet_bumpfee.py
@@ -57,8 +57,7 @@ class BumpFeeTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
self.setup_clean_chain = True
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [[
"-mintxfee=0.00002",
"-addresstype=bech32",
### test/functional/wallet_change_address.py
@@ -17,8 +17,7 @@ class WalletChangeAddressTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 3
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
# discardfee is used to make change outputs less likely in the change_pos test
self.extra_args = [
[],
### test/functional/wallet_conflicts.py
@@ -17,8 +17,7 @@
class TxConflicts(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 3
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
### test/functional/wallet_exported_watchonly.py
@@ -21,8 +21,7 @@ class WalletExportedWatchOnly(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [[], [f"-keypool={KEYPOOL_SIZE}"]]
def setup_network(self):
### test/functional/wallet_fundrawtransaction.py
@@ -48,8 +48,7 @@ def set_test_params(self):
] for i in range(self.num_nodes)]
self.setup_clean_chain = True
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.rpc_timeout = 90 # to prevent timeouts in `test_transaction_too_large`
self.supports_cli = False
### test/functional/wallet_groups.py
@@ -19,8 +19,7 @@ class WalletGroupTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 5
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [
[],
[],
### test/functional/wallet_hd.py
@@ -21,8 +21,7 @@ def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
self.extra_args = [[], ['-keypool=0']]
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
### test/functional/wallet_importdescriptors.py
@@ -41,8 +41,7 @@
class ImportDescriptorsTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [["-addresstype=legacy"],
["-addresstype=bech32", "-keypool=5"]
]
### test/functional/wallet_importprunedfunds.py
@@ -26,8 +26,7 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [["-deprecatedrpc=removeprunedfunds"]] * 2
def skip_test_if_missing_module(self):
### test/functional/wallet_listreceivedby.py
@@ -18,8 +18,7 @@
class ReceivedByTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
### test/functional/wallet_listsinceblock.py
@@ -23,8 +23,7 @@ class ListSinceBlockTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
self.setup_clean_chain = True
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
### test/functional/wallet_listtransactions.py
@@ -27,8 +27,7 @@
class ListTransactionsTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 3
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
### test/functional/wallet_orphanedreward.py
@@ -11,8 +11,7 @@ class OrphanedBlockRewardTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
### test/functional/wallet_send.py
@@ -29,8 +29,7 @@
class WalletSendTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.supports_cli = False
self.extra_args = [["-datacarriersize=16"]] * self.num_nodes
getcontext().prec = 8 # Satoshi precision for Decimal
### test/functional/wallet_signer.py
@@ -37,8 +37,7 @@ def mock_multi_signers_path(self):
def set_test_params(self):
self.num_nodes = 2
- # whitelist peers to speed up tx relay / mempool sync
- self.noban_tx_relay = True
+ self.noban_tx_relay = True # faster tx relay
self.extra_args = [
[],Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.