Merge bitcoin/bitcoin#23777: doc: follow-ups from #23365 (index backwards search)

e4a8d561ed doc: add explanations for assert in index and magic numbers in test (Martin Zumsande)

Pull request description:

  This adds two explanations suggested in the review of #23365,  that I didn't manage to address before that PR was merged:

  https://github.com/bitcoin/bitcoin/pull/23365#discussion_r763981042
  https://github.com/bitcoin/bitcoin/pull/23365#discussion_r763982639

ACKs for top commit:
  jnewbery:
    ACK e4a8d561ed

Tree-SHA512: 0500c8abb37bb3e3694463ad5e74b2e1483615ccf1d7529b0d5faa694652ada17d242dc7fda6d995733766c627d54178a2c8fa21a570cdf13292f64ff5425b56
pull/826/head
MarcoFalke 3 years ago
commit df6e961c41
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -96,6 +96,8 @@ bool BaseIndex::Init()
prune_violation = false; prune_violation = false;
break; break;
} }
// block->pprev must exist at this point, since block_to_test is part of the chain
// and thus must be encountered when going backwards from the tip
assert(block->pprev); assert(block->pprev);
block = block->pprev; block = block->pprev;
} }

@ -29,6 +29,8 @@ class FeatureBlockfilterindexPruneTest(BitcoinTestFramework):
self.log.info("prune some blocks") self.log.info("prune some blocks")
pruneheight = self.nodes[0].pruneblockchain(400) pruneheight = self.nodes[0].pruneblockchain(400)
# the prune heights used here and below are magic numbers that are determined by the
# thresholds at which block files wrap, so they depend on disk serialization and default block file size.
assert_equal(pruneheight, 248) assert_equal(pruneheight, 248)
self.log.info("check if we can access the tips blockfilter when we have pruned some blocks") self.log.info("check if we can access the tips blockfilter when we have pruned some blocks")

Loading…
Cancel
Save