diff --git a/test/functional/feature_blockfilterindex_prune.py b/test/functional/feature_blockfilterindex_prune.py index fcefd43cd4..9cc2d16d91 100755 --- a/test/functional/feature_blockfilterindex_prune.py +++ b/test/functional/feature_blockfilterindex_prune.py @@ -9,6 +9,7 @@ from test_framework.util import ( assert_greater_than, assert_raises_rpc_error, ) +from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE class FeatureBlockfilterindexPruneTest(BitcoinTestFramework): @@ -42,7 +43,7 @@ class FeatureBlockfilterindexPruneTest(BitcoinTestFramework): assert_greater_than(len(self.nodes[0].getblockfilter(self.nodes[0].getblockhash(2))['filter']), 0) self.log.info("start node without blockfilterindex") - self.restart_node(0, extra_args=["-fastprune", "-prune=1"], expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.') + self.restart_node(0, extra_args=["-fastprune", "-prune=1"], expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE) self.log.info("make sure accessing the blockfilters throws an error") assert_raises_rpc_error(-1, "Index is not enabled for filtertype basic", self.nodes[0].getblockfilter, self.nodes[0].getblockhash(2)) @@ -51,17 +52,17 @@ class FeatureBlockfilterindexPruneTest(BitcoinTestFramework): self.log.info("prune below the blockfilterindexes best block while blockfilters are disabled") pruneheight_new = self.nodes[0].pruneblockchain(1000) assert_greater_than(pruneheight_new, pruneheight) - self.stop_node(0, expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.') + self.stop_node(0, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE) self.log.info("make sure we get an init error when starting the node again with block filters") self.nodes[0].assert_start_raises_init_error( extra_args=["-fastprune", "-prune=1", "-blockfilterindex=1"], - expected_msg="Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.\nError: basic block filter index best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)", + expected_msg=f"{EXPECTED_STDERR_NO_GOV_PRUNE}\nError: basic block filter index best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)", ) self.log.info("make sure the node starts again with the -reindex arg") self.start_node(0, extra_args=["-fastprune", "-prune=1", "-blockfilterindex", "-reindex"]) - self.stop_nodes(expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.') + self.stop_nodes(expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE) if __name__ == '__main__': diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py index cf9e78ece3..e722c28226 100755 --- a/test/functional/feature_pruning.py +++ b/test/functional/feature_pruning.py @@ -11,6 +11,10 @@ This test takes 30 mins or more (up to 2 hours) import os from test_framework.blocktools import create_coinbase +from test_framework.governance import ( + EXPECTED_STDERR_NO_GOV, + EXPECTED_STDERR_NO_GOV_PRUNE, +) from test_framework.messages import CBlock from test_framework.script import ( CScript, @@ -29,9 +33,6 @@ from test_framework.util import ( # compatible with pruning based on key creation time. TIMESTAMP_WINDOW = 2 * 60 * 60 -EXPECTED_STDERR_NO_GOV = "Warning: You are starting with governance validation disabled." -EXPECTED_STDERR_NO_GOV_PRUNE = EXPECTED_STDERR_NO_GOV + " This is expected because you are running a pruned node." - def mine_large_blocks(node, n): # Make a large scriptPubKey for the coinbase transaction. This is OP_RETURN # followed by 950k of OP_NOP. This would be non-standard in a non-coinbase diff --git a/test/functional/interface_usdt_utxocache.py b/test/functional/interface_usdt_utxocache.py index e9f98de523..0098e9c98b 100755 --- a/test/functional/interface_usdt_utxocache.py +++ b/test/functional/interface_usdt_utxocache.py @@ -14,6 +14,7 @@ try: except ImportError: pass from test_framework.messages import COIN +from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal from test_framework.wallet import MiniWallet @@ -402,7 +403,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework): assert_equal(0, len(possible_cache_sizes)) assert_equal(EXPECTED_HANDLE_FLUSH_SUCCESS, handle_flush_succeeds) - self.stop_node(0, expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.') + self.stop_node(0, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE) if __name__ == '__main__': UTXOCacheTracepointTest().main() diff --git a/test/functional/p2p_node_network_limited.py b/test/functional/p2p_node_network_limited.py index e176cc2e1e..16862fb918 100755 --- a/test/functional/p2p_node_network_limited.py +++ b/test/functional/p2p_node_network_limited.py @@ -9,6 +9,7 @@ and that it responds to getdata requests for blocks correctly: - send a block within 288 + 2 of the tip - disconnect peers who request blocks older than that.""" from test_framework.messages import CInv, MSG_BLOCK, msg_getdata, NODE_BLOOM, NODE_NETWORK_LIMITED, NODE_HEADERS_COMPRESSED +from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE from test_framework.p2p import P2PInterface from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal @@ -95,7 +96,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework): # sync must be possible, node 1 is no longer in IBD and should therefore connect to node 0 (NODE_NETWORK_LIMITED) self.sync_blocks([self.nodes[0], self.nodes[1]]) - self.stop_node(0, expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.') + self.stop_node(0, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE) if __name__ == '__main__': diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py index fedeb1f3d8..9547f44624 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -31,6 +31,7 @@ from test_framework.blocktools import ( create_coinbase, TIME_GENESIS_BLOCK, ) +from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE from test_framework.messages import ( CBlockHeader, from_hex, @@ -125,7 +126,7 @@ class BlockchainTest(BitcoinTestFramework): assert res['pruned'] assert not res['automatic_pruning'] - self.restart_node(0, ['-stopatheight=207', '-txindex=0'], expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.') + self.restart_node(0, ['-stopatheight=207', '-txindex=0'], expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE) res = self.nodes[0].getblockchaininfo() # should have exact keys assert_equal(sorted(res.keys()), keys) diff --git a/test/functional/test_framework/governance.py b/test/functional/test_framework/governance.py index 2132fb3a27..9eb46081fb 100644 --- a/test/functional/test_framework/governance.py +++ b/test/functional/test_framework/governance.py @@ -6,6 +6,9 @@ import json +EXPECTED_STDERR_NO_GOV = "Warning: You are starting with governance validation disabled." +EXPECTED_STDERR_NO_GOV_PRUNE = f"{EXPECTED_STDERR_NO_GOV} This is expected because you are running a pruned node." + def prepare_object(node, object_type, parent_hash, creation_time, revision, name, amount, payment_address): proposal_rev = revision proposal_time = int(creation_time) diff --git a/test/functional/wallet_import_rescan.py b/test/functional/wallet_import_rescan.py index 8f321c4b20..4b1969afb2 100755 --- a/test/functional/wallet_import_rescan.py +++ b/test/functional/wallet_import_rescan.py @@ -20,6 +20,7 @@ happened previously. """ from test_framework.test_framework import BitcoinTestFramework +from test_framework.governance import EXPECTED_STDERR_NO_GOV_PRUNE from test_framework.util import ( assert_equal, set_node_times, @@ -213,7 +214,7 @@ class ImportRescanTest(BitcoinTestFramework): variant.check(variant.sent_txid, variant.sent_amount, variant.confirmation_height) for i, import_node in enumerate(IMPORT_NODES, 2): if import_node.prune: - self.stop_node(i, expected_stderr='Warning: You are starting with governance validation disabled. This is expected because you are running a pruned node.') + self.stop_node(i, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)