From e1183c28b579f88fa9fd152db79a5d32358d7921 Mon Sep 17 00:00:00 2001 From: Peter Bushnell Date: Thu, 29 Nov 2018 11:53:10 +0000 Subject: [PATCH] Reset checkpoint if not found --- src/checkpointsync.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/checkpointsync.cpp b/src/checkpointsync.cpp index 36c423f8f2..883c4d3acd 100644 --- a/src/checkpointsync.cpp +++ b/src/checkpointsync.cpp @@ -177,8 +177,12 @@ bool CheckSyncCheckpoint(const CBlockIndex* pindexNew) const uint256& hashBlock = pindexNew->GetBlockHash(); int nHeight = pindexNew->nHeight; - // Checkpoint should always be accepted block - assert(mapBlockIndex.count(hashSyncCheckpoint)); + // Reset checkpoint to Genesis block if not found or initialised + if (hashSyncCheckpoint == ArithToUint256(arith_uint256(0)) || !(mapBlockIndex.count(hashSyncCheckpoint))) { + WriteSyncCheckpoint(Params().GetConsensus().hashGenesisBlock); + return true; + } + const CBlockIndex* pindexSync = mapBlockIndex[hashSyncCheckpoint]; // Blocks could have been rewound on startup, do not