HomePhabricator

validation: don't try to invalidate genesis block

Description

validation: don't try to invalidate genesis block

Summary:

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(). Rather than analyzing all possible code paths and implications for this corner case, simply fail early if the genesis block is passed.

This is a backport of core#20921

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12264

Details

Provenance
Sebastian Falbesoner <sebastian.falbesoner@gmail.com>Authored on Jan 12 2021, 22:52
PiRKCommitted on Oct 17 2022, 13:14
PiRKPushed on Oct 17 2022, 13:14
Reviewer
Restricted Project
Differential Revision
D12264: validation: don't try to invalidate genesis block
Parents
rABCfb491c3b206a: Make addrman random context private
Branches
Unknown
Tags
Unknown