X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fcheckpoints.h;h=d5c0b068ab648daaaa6182770eec036ee9073487;hb=HEAD;hp=0250618e47a04f55c11e6635b0b1d36071cb4c43;hpb=f2b467c8d7d761dd47e58ad9ed4d8ede92a24601;p=novacoin.git diff --git a/src/checkpoints.h b/src/checkpoints.h index 0250618..d5c0b06 100644 --- a/src/checkpoints.h +++ b/src/checkpoints.h @@ -4,9 +4,12 @@ #ifndef BITCOIN_CHECKPOINT_H #define BITCOIN_CHECKPOINT_H -#include #include "util.h" -#include "net.h" +#include "serialize.h" +#include "sync.h" +#include "uint256.h" + +#include // max 1 hour before latest block static const int64_t CHECKPOINT_MAX_SPAN = nOneHour; @@ -17,9 +20,9 @@ static const int64_t CHECKPOINT_MAX_SPAN = nOneHour; #undef ADVISORY #endif -class uint256; class CBlockIndex; class CSyncCheckpoint; +class CNode; /** Block-chain checkpoints are compiled-in sanity checks. * They are updated every release or three. @@ -100,11 +103,6 @@ public: nVersion, hashCheckpoint.ToString().c_str()); } - - void print() const - { - printf("%s", ToString().c_str()); - } }; class CSyncCheckpoint : public CUnsignedSyncCheckpoint @@ -116,10 +114,7 @@ public: std::vector vchMsg; std::vector vchSig; - CSyncCheckpoint() - { - SetNull(); - } + CSyncCheckpoint(); IMPLEMENT_SERIALIZE ( @@ -127,35 +122,10 @@ public: READWRITE(vchSig); ) - void SetNull() - { - CUnsignedSyncCheckpoint::SetNull(); - vchMsg.clear(); - vchSig.clear(); - } - - bool IsNull() const - { - return (hashCheckpoint == 0); - } - - uint256 GetHash() const - { - return SerializeHash(*this); - } - - bool RelayTo(CNode* pnode) const - { - // returns true if wasn't already sent - if (pnode->hashCheckpointKnown != hashCheckpoint) - { - pnode->hashCheckpointKnown = hashCheckpoint; - pnode->PushMessage("checkpoint", *this); - return true; - } - return false; - } - + void SetNull(); + bool IsNull() const; + uint256 GetHash() const; + bool RelayTo(CNode* pnode) const; bool CheckSignature(); bool ProcessSyncCheckpoint(CNode* pfrom); };