mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-24 08:41:59 +01:00
Merge bitcoin/bitcoin#29428: test: Assumeutxo: snapshots with less work should not be loaded
df6dc2aaaeffc664006b86ee8c8797dc484ec40e test: Assumeutxo: snapshots with less work should not be loaded (Hernan Marino)
Pull request description:
This PR adds a test which checks that snapshots with less accumulated work than the node's active chain, should not be loaded and return with an error. Although in a different context of discussion the missing test was detect in a thread in https://github.com/bitcoin/bitcoin/pull/29394 (see https://github.com/bitcoin/bitcoin/pull/29394#discussion_r1484122214)
ACKs for top commit:
maflcko:
utACK df6dc2aaaeffc664006b86ee8c8797dc484ec40e
kevkevinpal:
utACK [df6dc2a](df6dc2aaae
)
achow101:
ACK df6dc2aaaeffc664006b86ee8c8797dc484ec40e
alfonsoromanz:
Re ACK df6dc2aaaeffc664006b86ee8c8797dc484ec40e. Make is successful and the test passes.
Tree-SHA512: 07a394b4b288cc8ad3f66ed4e70dcda468db18113e9442eb7215cf491768432d55efaaa5b79d633094917e05475a30f0c5e4f64f8f2da293ba306891b4485560
This commit is contained in:
commit
56ea8ed3d3
@ -196,6 +196,14 @@ class AssumeutxoTest(BitcoinTestFramework):
|
||||
path = node.datadir_path / node.chain / "invalid" / "path"
|
||||
assert_raises_rpc_error(-8, "Couldn't open file {} for reading.".format(path), node.loadtxoutset, path)
|
||||
|
||||
def test_snapshot_with_less_work(self, dump_output_path):
|
||||
self.log.info("Test bitcoind should fail when snapshot has less accumulated work than this node.")
|
||||
node = self.nodes[0]
|
||||
assert_equal(node.getblockcount(), FINAL_HEIGHT)
|
||||
with node.assert_debug_log(expected_msgs=["[snapshot] activation failed - work does not exceed active chainstate"]):
|
||||
assert_raises_rpc_error(-32603, "Unable to load UTXO snapshot", node.loadtxoutset, dump_output_path)
|
||||
self.restart_node(0, extra_args=self.extra_args[0])
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Bring up two (disconnected) nodes, mine some new blocks on the first,
|
||||
@ -277,6 +285,7 @@ class AssumeutxoTest(BitcoinTestFramework):
|
||||
|
||||
assert_equal(n0.getblockchaininfo()["blocks"], FINAL_HEIGHT)
|
||||
|
||||
self.test_snapshot_with_less_work(dump_output['path'])
|
||||
self.test_invalid_mempool_state(dump_output['path'])
|
||||
self.test_invalid_snapshot_scenarios(dump_output['path'])
|
||||
self.test_invalid_chainstate_scenarios()
|
||||
|
Loading…
x
Reference in New Issue
Block a user