mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
test, assumeutxo: Add test to ensure failure when mempool not empty
This commit is contained in:
parent
9eeee7caa3
commit
8d20602e55
1 changed files with 15 additions and 1 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue