mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge 8ae79f1155 into merged_master (Bitcoin PR bitcoin/bitcoin#30403)
This commit is contained in:
commit
6ded286f69
1 changed files with 7 additions and 15 deletions
|
|
@ -8,20 +8,6 @@ to a hash that has been compiled into bitcoind.
|
|||
|
||||
The assumeutxo value generated and used here is committed to in
|
||||
`CRegTestParams::m_assumeutxo_data` in `src/kernel/chainparams.cpp`.
|
||||
|
||||
## Possible test improvements
|
||||
|
||||
Interesting test cases could be loading an assumeutxo snapshot file with:
|
||||
|
||||
- TODO: Valid snapshot file, but referencing a snapshot block that turns out to be
|
||||
invalid, or has an invalid parent
|
||||
|
||||
Interesting starting states could be loading a snapshot when the current chain tip is:
|
||||
|
||||
- TODO: An ancestor of snapshot block
|
||||
- TODO: The snapshot block
|
||||
- TODO: A descendant of the snapshot block
|
||||
|
||||
"""
|
||||
from decimal import Decimal
|
||||
from shutil import rmtree
|
||||
|
|
@ -203,7 +189,6 @@ class AssumeutxoTest(BitcoinTestFramework):
|
|||
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)
|
||||
|
||||
|
|
@ -317,6 +302,11 @@ class AssumeutxoTest(BitcoinTestFramework):
|
|||
self.log.info(f"Creating a UTXO snapshot at height {SNAPSHOT_BASE_HEIGHT}")
|
||||
dump_output = n0.dumptxoutset('utxos.dat')
|
||||
|
||||
self.log.info("Test loading snapshot when the node tip is on the same block as the snapshot")
|
||||
assert_equal(n0.getblockcount(), SNAPSHOT_BASE_HEIGHT)
|
||||
assert_equal(n0.getblockchaininfo()["blocks"], SNAPSHOT_BASE_HEIGHT)
|
||||
self.test_snapshot_with_less_work(dump_output['path'])
|
||||
|
||||
self.log.info("Test loading snapshot when headers are not synced")
|
||||
self.test_headers_not_synced(dump_output['path'])
|
||||
|
||||
|
|
@ -359,6 +349,8 @@ class AssumeutxoTest(BitcoinTestFramework):
|
|||
self.test_snapshot_not_on_most_work_chain(dump_output['path'])
|
||||
|
||||
self.log.info(f"Loading snapshot into second node from {dump_output['path']}")
|
||||
# This node's tip is on an ancestor block of the snapshot, which should
|
||||
# be the normal case
|
||||
loaded = n1.loadtxoutset(dump_output['path'])
|
||||
assert_equal(loaded['coins_loaded'], SNAPSHOT_BASE_HEIGHT)
|
||||
assert_equal(loaded['base_height'], SNAPSHOT_BASE_HEIGHT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue