Skip to content

Commit

Permalink
doc: add explanations for assert in index and magic numbers in test
Browse files Browse the repository at this point in the history
These were suggested in review of bitcoin#23365

Co-authored-by: John Newbery <john@johnnewbery.com>
  • Loading branch information
mzumsande and jnewbery committed Dec 15, 2021
1 parent aaaceb7 commit e4a8d56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ bool BaseIndex::Init()
prune_violation = false;
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);
block = block->pprev;
}
Expand Down
2 changes: 2 additions & 0 deletions test/functional/feature_blockfilterindex_prune.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def run_test(self):

self.log.info("prune some blocks")
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)

self.log.info("check if we can access the tips blockfilter when we have pruned some blocks")
Expand Down

0 comments on commit e4a8d56

Please sign in to comment.