aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2024-02-13 09:55:12 -0300
committerfanquake <fanquake@gmail.com>2024-02-13 10:04:24 -0300
commitf83565db45dece755848d6eba2c921973e9db81e (patch)
tree4a1538f768155a9bea7cb9f5a10eae832c75ba8e /test
parent37fdf5a492786c1772b5b40773a1031237447070 (diff)
parent8d20602e555dfe026b421363ee32cfca17c674d8 (diff)
Merge bitcoin/bitcoin#29394: test, assumeutxo: Add test to ensure failure when mempool not empty
8d20602e555dfe026b421363ee32cfca17c674d8 test, assumeutxo: Add test to ensure failure when mempool not empty (Hernan Marino) Pull request description: Add a test to ensure that loadtxoutset fails when the node's mempool is not empty, as suggested by maflcko here: https://github.com/bitcoin/bitcoin/pull/27596#discussion_r1344713537 ACKs for top commit: maflcko: re-ACK 8d20602e555dfe026b421363ee32cfca17c674d8 BrandonOdiwuor: ACK 8d20602e555dfe026b421363ee32cfca17c674d8 Tree-SHA512: 97c9668c0f38897934bf0d326515d898d4e682ff219deba9d751b35125b5cf33d51c9df116a74117ecf0394f28995a3d0cae1266b1e5acb4365ff4f309ce3f6c
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_assumeutxo.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/functional/feature_assumeutxo.py b/test/functional/feature_assumeutxo.py
index 528680f2ca..60dd751ff8 100755
--- a/test/functional/feature_assumeutxo.py
+++ b/test/functional/feature_assumeutxo.py
@@ -60,7 +60,7 @@ class AssumeutxoTest(BitcoinTestFramework):
self.extra_args = [
[],
["-fastprune", "-prune=1", "-blockfilterindex=1", "-coinstatsindex=1"],
- ["-txindex=1", "-blockfilterindex=1", "-coinstatsindex=1"],
+ ["-persistmempool=0","-txindex=1", "-blockfilterindex=1", "-coinstatsindex=1"],
]
def setup_network(self):
@@ -135,6 +135,19 @@ class AssumeutxoTest(BitcoinTestFramework):
rmtree(chainstate_snapshot_path)
self.start_node(0)
+ def test_invalid_mempool_state(self, dump_output_path):
+ self.log.info("Test bitcoind should fail when mempool not empty.")
+ node=self.nodes[2]
+ tx = MiniWallet(node).send_self_transfer(from_node=node)
+
+ assert tx['txid'] in node.getrawmempool()
+
+ # Attempt to load the snapshot on Node 2 and expect it to fail
+ with node.assert_debug_log(expected_msgs=["[snapshot] can't activate a snapshot when mempool not empty"]):
+ assert_raises_rpc_error(-32603, "Unable to load UTXO snapshot", node.loadtxoutset, dump_output_path)
+
+ self.restart_node(2, extra_args=self.extra_args[2])
+
def run_test(self):
"""
Bring up two (disconnected) nodes, mine some new blocks on the first,
@@ -197,6 +210,7 @@ class AssumeutxoTest(BitcoinTestFramework):
assert_equal(n0.getblockchaininfo()["blocks"], FINAL_HEIGHT)
+ self.test_invalid_mempool_state(dump_output['path'])
self.test_invalid_snapshot_scenarios(dump_output['path'])
self.test_invalid_chainstate_scenarios()