Page MenuHomePhabricator

make GetFirstStoredBlock assert that 'start_block' always has data
ClosedPublic

Authored by PiRK on Tue, Mar 4, 10:11.

Details

Summary

And transfer the responsibility of verifying whether 'start_block'
has data or not to the caller.

This is because the 'GetFirstStoredBlock' function responsibility
is to return the first block containing data. And the current
implementation can return 'start_block' when it has no data!. Which
is misleading at least.

Edge case behavior change:
Previously, if the block tip lacked data but all preceding blocks
contained data, there was no prune violation. And now, such
scenario will result in a prune violation.

This is a partial backport of core#27607
https://github.com/bitcoin/bitcoin/pull/27607/commits/c82ef91eae38f385d408b095ebbc8a180ce52ebb

Depends on D17746

Test Plan

ninja all check-all