Skip to content

Commit 787df19

Browse files
committed
validation: don't try to invalidate genesis block
1 parent 7b97563 commit 787df19

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/validation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,6 +2923,10 @@ bool PreciousBlock(BlockValidationState& state, const CChainParams& params, CBlo
29232923

29242924
bool CChainState::InvalidateBlock(BlockValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex)
29252925
{
2926+
// Genesis block can't be invalidated
2927+
assert(pindex);
2928+
if (pindex->nHeight == 0) return false;
2929+
29262930
CBlockIndex* to_mark_failed = pindex;
29272931
bool pindex_was_in_chain = false;
29282932
int disconnected = 0;

0 commit comments

Comments
 (0)