return true;
}
- bool CSyncCheckpoint::ProcessSyncCheckpoint(CNode* pfrom)
- {
- if (!CheckSignature())
- return false;
-
- CRITICAL_BLOCK(cs_hashSyncCheckpoint)
- {
- if (!mapBlockIndex.count(hashCheckpoint))
- {
- // We haven't accepted this block, keep the checkpoint as pending
- checkpointMessagePending = *this;
- // Ask this guy to fill in what we're missing
- if (pfrom)
- pfrom->PushGetBlocks(pindexBest, hashCheckpoint);
- return false;
- }
- if (!ValidateSyncCheckpoint(hashCheckpoint))
- return false;
- hashSyncCheckpoint = this->hashCheckpoint;
- checkpointMessage = *this;
- checkpointMessagePending.SetNull();
- }
- return true;
- }
-
bool AcceptPendingSyncCheckpoint(uint256 hashAcceptedBlock)
{
if (!mapBlockIndex.count(hashAcceptedBlock))
hashSyncCheckpoint = checkpointMessagePending.hashCheckpoint;
checkpointMessage = checkpointMessagePending;
checkpointMessagePending.SetNull();
+ printf("AcceptPendingSyncCheckpoint : sync-checkpoint at %s\n", hashSyncCheckpoint.ToString().c_str());
+ // relay the checkpoint
+ BOOST_FOREACH(CNode* pnode, vNodes)
+ checkpointMessage.RelayTo(pnode);
return true;
}
return true;
}
}
+
+// ppcoin: process synchronized checkpoint
+bool CSyncCheckpoint::ProcessSyncCheckpoint(CNode* pfrom)
+{
+ if (!CheckSignature())
+ return false;
+
+ CRITICAL_BLOCK(Checkpoints::cs_hashSyncCheckpoint)
+ {
+ if (!mapBlockIndex.count(hashCheckpoint))
+ {
+ // We haven't accepted this block, keep the checkpoint as pending
+ Checkpoints::checkpointMessagePending = *this;
+ printf("ProcessSyncCheckpoint : pending for sync-checkpoint %s\n", hashCheckpoint.ToString().c_str());
+ // Ask this guy to fill in what we're missing
+ if (pfrom)
+ pfrom->PushGetBlocks(pindexBest, hashCheckpoint);
+ return false;
+ }
+ if (!Checkpoints::ValidateSyncCheckpoint(hashCheckpoint))
+ return false;
+ Checkpoints::hashSyncCheckpoint = this->hashCheckpoint;
+ Checkpoints::checkpointMessage = *this;
+ Checkpoints::checkpointMessagePending.SetNull();
+ printf("ProcessSyncCheckpoint : sync-checkpoint at %s\n", Checkpoints::hashSyncCheckpoint.ToString().c_str());
+ }
+ return true;
+}