Skip to content

Commit

Permalink
ProcessSyncCheckpoint update
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Nov 6, 2018
1 parent 7e9de51 commit 6ff8bfc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/checkpointsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,24 @@ bool CSyncCheckpoint::ProcessSyncCheckpoint(CNode* pfrom)
LOCK(cs_main);
if (!mapBlockIndex.count(hashCheckpoint))
{
LogPrintf("Missing headers for received sync-checkpoint %s\n", hashCheckpoint.ToString());
return false;
}

if (!ValidateSyncCheckpoint(hashCheckpoint))
return false;

bool pass = chainActive.Contains(mapBlockIndex[hashCheckpoint]);

if (!pass) {
// We haven't received the checkpoint chain, keep the checkpoint as pending
hashPendingCheckpoint = hashCheckpoint;
checkpointMessagePending = *this;
LogPrintf("%s: pending for sync-checkpoint %s\n", __func__, hashCheckpoint.ToString());

return false;
}

if (!ValidateSyncCheckpoint(hashCheckpoint))
return false;

if (!WriteSyncCheckpoint(hashCheckpoint))
return error("%s: failed to write sync checkpoint %s", __func__, hashCheckpoint.ToString());

Expand Down

0 comments on commit 6ff8bfc

Please sign in to comment.