mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
Merge bitcoin/bitcoin#36150: indexes: set prune lock to genesis before first block
9b22995140indexes: set prune lock to genesis before first block (Andrew Toth)0ae3b40c27test: characterize startup with newly added prune and index (Andrew Toth) Pull request description: When setting both a new index and prune size and restarting an unpruned node, the node will prune the block store first and then the index will fail to start syncing. Fix this by setting the prune lock to 0 if the index does not yet have a best block. ACKs for top commit: sedited: Re-ACK9b22995140fjahr: Code review ACK9b22995140Tree-SHA512: fff46c65c6350bdcbb3e0bbc8cde655c619ce48c19730e3caf3175257f7d3cb1abb8cce07f84cf78e20e54f9e3e4963da072cdde6d01a1ceb8a731920220cd13
This commit is contained in:
@@ -504,9 +504,9 @@ void BaseIndex::SetBestBlockIndex(const CBlockIndex* block)
|
||||
{
|
||||
assert(!m_chainstate->m_blockman.IsPruneMode() || AllowPrune());
|
||||
|
||||
if (AllowPrune() && block) {
|
||||
if (AllowPrune()) {
|
||||
node::PruneLockInfo prune_lock;
|
||||
prune_lock.height_first = block->nHeight;
|
||||
prune_lock.height_first = block ? block->nHeight : 0;
|
||||
WITH_LOCK(::cs_main, m_chainstate->m_blockman.UpdatePruneLock(GetName(), prune_lock));
|
||||
}
|
||||
|
||||
|
||||
@@ -470,6 +470,11 @@ class PruneTest(BitcoinTestFramework):
|
||||
self.connect_nodes(0, 5)
|
||||
self.sync_blocks([self.nodes[0], self.nodes[5]], wait=5, timeout=300)
|
||||
|
||||
self.log.info("Test prune with a new index")
|
||||
self.restart_node(0, extra_args=["-prune=550", "-blockfilterindex=1"])
|
||||
node = self.nodes[0]
|
||||
self.wait_until(lambda: node.getindexinfo()["basic block filter index"]["best_block_height"] >= 10, timeout=300)
|
||||
|
||||
if self.is_wallet_compiled():
|
||||
self.log.info("Test wallet re-scan")
|
||||
self.test_wallet_rescan()
|
||||
|
||||
Reference in New Issue
Block a user