mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-17 21:32:00 +01:00
Merge 52482cb24400f8c44ba9628aaaecb7c04b11beb2 into 5f4422d68dc3530c353af1f87499de1c864b60ad
This commit is contained in:
commit
3d4d861604
@ -9,6 +9,7 @@ to a hash that has been compiled into bitcoind.
|
|||||||
The assumeutxo value generated and used here is committed to in
|
The assumeutxo value generated and used here is committed to in
|
||||||
`CRegTestParams::m_assumeutxo_data` in `src/kernel/chainparams.cpp`.
|
`CRegTestParams::m_assumeutxo_data` in `src/kernel/chainparams.cpp`.
|
||||||
"""
|
"""
|
||||||
|
import contextlib
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
@ -349,6 +350,22 @@ class AssumeutxoTest(BitcoinTestFramework):
|
|||||||
assert 'NETWORK' not in node_services
|
assert 'NETWORK' not in node_services
|
||||||
assert 'NETWORK_LIMITED' in node_services
|
assert 'NETWORK_LIMITED' in node_services
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def assert_disk_cleanup(self, node, assumeutxo_used):
|
||||||
|
"""
|
||||||
|
Ensure an assumeutxo node is cleaning up the background chainstate
|
||||||
|
"""
|
||||||
|
msg = []
|
||||||
|
if assumeutxo_used:
|
||||||
|
# Check that the snapshot actually existed before restart
|
||||||
|
assert (node.datadir_path / node.chain / "chainstate_snapshot").exists()
|
||||||
|
msg = ["cleaning up unneeded background chainstate"]
|
||||||
|
|
||||||
|
with node.assert_debug_log(msg):
|
||||||
|
yield
|
||||||
|
|
||||||
|
assert not (node.datadir_path / node.chain / "chainstate_snapshot").exists()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
"""
|
"""
|
||||||
Bring up two (disconnected) nodes, mine some new blocks on the first,
|
Bring up two (disconnected) nodes, mine some new blocks on the first,
|
||||||
@ -656,7 +673,8 @@ class AssumeutxoTest(BitcoinTestFramework):
|
|||||||
for i in (0, 1):
|
for i in (0, 1):
|
||||||
n = self.nodes[i]
|
n = self.nodes[i]
|
||||||
self.log.info(f"Restarting node {i} to ensure (Check|Load)BlockIndex passes")
|
self.log.info(f"Restarting node {i} to ensure (Check|Load)BlockIndex passes")
|
||||||
self.restart_node(i, extra_args=self.extra_args[i])
|
with self.assert_disk_cleanup(n, i == 1):
|
||||||
|
self.restart_node(i, extra_args=self.extra_args[i])
|
||||||
|
|
||||||
assert_equal(n.getblockchaininfo()["blocks"], FINAL_HEIGHT)
|
assert_equal(n.getblockchaininfo()["blocks"], FINAL_HEIGHT)
|
||||||
|
|
||||||
@ -733,7 +751,8 @@ class AssumeutxoTest(BitcoinTestFramework):
|
|||||||
for i in (0, 2):
|
for i in (0, 2):
|
||||||
n = self.nodes[i]
|
n = self.nodes[i]
|
||||||
self.log.info(f"Restarting node {i} to ensure (Check|Load)BlockIndex passes")
|
self.log.info(f"Restarting node {i} to ensure (Check|Load)BlockIndex passes")
|
||||||
self.restart_node(i, extra_args=self.extra_args[i])
|
with self.assert_disk_cleanup(n, i == 2):
|
||||||
|
self.restart_node(i, extra_args=self.extra_args[i])
|
||||||
|
|
||||||
assert_equal(n.getblockchaininfo()["blocks"], FINAL_HEIGHT)
|
assert_equal(n.getblockchaininfo()["blocks"], FINAL_HEIGHT)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user