Skip to content

Commit

Permalink
Reset checkpoint if not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Nov 29, 2018
1 parent 19e6395 commit e1183c2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/checkpointsync.cpp
Expand Up @@ -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
Expand Down

0 comments on commit e1183c2

Please sign in to comment.