Merge #20921: validation: don't try to invalidate genesis block in CChainState::InvalidateBlock
pull/826/head787df19b09
validation: don't try to invalidate genesis block (Sebastian Falbesoner) Pull request description: In the block invalidation method (`CChainState::InvalidateBlock`), the code for creating the candidate block map assumes that the passed block's previous block (`pindex->pprev`) is available and otherwise segfaults due to null-pointer deference in `CBlockIndexWorkComparator()` (see analysis by practicalswift in #20914), i.e. it doesn't work with the genesis block. Rather than analyzing all possible code paths and implications for this corner case, simply fail early if the genesis block is passed. Fixes #20914. ACKs for top commit: sipa: ACK787df19b09
. Tested invalidation of generic on regtest. practicalswift: Tested ACK787df19b09
Tree-SHA512: 978be7cf2bd1c1faebfe945d191ac77dea72791bea826459abd308f77c74c5991efee495a38817c306e488ecd5208b5c888df7d9d044132dd9a06bbbdb256b6c
commit
63952f73b3
Loading…
Reference in new issue