class uint256;
class CBlockIndex;
+class CSyncCheckpoint;
+
+//
+// Block-chain checkpoints are compiled-in sanity checks.
+// They are updated every release or three.
+//
+namespace Checkpoints
+{
+ // Returns true if block passes checkpoint checks
+ bool CheckHardened(int nHeight, const uint256& hash);
+
+ // Return conservative estimate of total number of blocks, 0 if unknown
+ int GetTotalBlocksEstimate();
+
+ // Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
+ CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex);
+
+ extern uint256 hashSyncCheckpoint;
+ extern CSyncCheckpoint checkpointMessage;
+ extern uint256 hashInvalidCheckpoint;
+ extern CCriticalSection cs_hashSyncCheckpoint;
+
+ CBlockIndex* GetLastSyncCheckpoint();
+ bool WriteSyncCheckpoint(const uint256& hashCheckpoint);
+ bool AcceptPendingSyncCheckpoint();
+ uint256 AutoSelectSyncCheckpoint();
+ bool CheckSync(const uint256& hashBlock, const CBlockIndex* pindexPrev);
+ bool WantedByPendingSyncCheckpoint(uint256 hashBlock);
+ bool ResetSyncCheckpoint();
+}
// ppcoin: synchronized checkpoint
class CUnsignedSyncCheckpoint
class CSyncCheckpoint : public CUnsignedSyncCheckpoint
{
public:
+ static const std::string strMasterPubKey;
+
std::vector<unsigned char> vchMsg;
std::vector<unsigned char> vchSig;
return false;
}
- bool CheckSignature()
- {
- CKey key;
- if (!key.SetPubKey(ParseHex("04ea21daea8c15559870b5e93750ddc2f0c16bd0cb16636ba88c0746cfac07912ec7ad14111cc4aedda12c2687c920c7b7b62fd67ca14eed53f2d1704ec72362ce")))
- return error("CSyncCheckpoint::CheckSignature() : SetPubKey failed");
- if (!key.Verify(Hash(vchMsg.begin(), vchMsg.end()), vchSig))
- return error("CSyncCheckpoint::CheckSignature() : verify signature failed");
-
- // Now unserialize the data
- CDataStream sMsg(vchMsg);
- sMsg >> *(CUnsignedSyncCheckpoint*)this;
- return true;
- }
-
+ bool CheckSignature();
bool ProcessSyncCheckpoint(CNode* pfrom);
};
-//
-// Block-chain checkpoints are compiled-in sanity checks.
-// They are updated every release or three.
-//
-namespace Checkpoints
-{
- // Returns true if block passes checkpoint checks
- bool CheckHardened(int nHeight, const uint256& hash);
-
- // Return conservative estimate of total number of blocks, 0 if unknown
- int GetTotalBlocksEstimate();
-
- // Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
- CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex);
-
- extern uint256 hashSyncCheckpoint;
- extern CSyncCheckpoint checkpointMessage;
- extern CCriticalSection cs_hashSyncCheckpoint;
-
- bool AcceptPendingSyncCheckpoint();
- uint256 AutoSelectSyncCheckpoint();
- bool CheckSync(int nHeight, const uint256& hashBlock);
-
- // ppcoin: automatic checkpoint
- extern int nAutoCheckpoint;
- extern int nBranchPoint;
-
- bool CheckAuto(const CBlockIndex *pindex);
- int GetNextChainCheckpoint(const CBlockIndex *pindex);
- int GetNextAutoCheckpoint(int nCheckpoint);
- void AdvanceAutoCheckpoint(int nCheckpoint);
- bool ResetAutoCheckpoint(int nCheckpoint);
-}
-
#endif