From 787df19b09babf50dd8124b3ac990b29c33cfe93 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Tue, 12 Jan 2021 23:52:06 +0100 Subject: [PATCH] validation: don't try to invalidate genesis block --- src/validation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/validation.cpp b/src/validation.cpp index 4f7c95b2ad..5445511c04 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2923,6 +2923,10 @@ bool PreciousBlock(BlockValidationState& state, const CChainParams& params, CBlo bool CChainState::InvalidateBlock(BlockValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex) { + // Genesis block can't be invalidated + assert(pindex); + if (pindex->nHeight == 0) return false; + CBlockIndex* to_mark_failed = pindex; bool pindex_was_in_chain = false; int disconnected = 0;