X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fcheckpoints.h;h=3255412168f630ffcf9d212928e6ea2168f31634;hb=b43972dc5dabf467a997f51b24d561641a0c6514;hp=a52f7209dedd903a97ffbae0060ba89892dceffd;hpb=8c8cd5f399c10e3670955dff8a7c22dd20934bb4;p=novacoin.git diff --git a/src/checkpoints.h b/src/checkpoints.h index a52f720..3255412 100644 --- a/src/checkpoints.h +++ b/src/checkpoints.h @@ -1,20 +1,53 @@ -// Copyright (c) 2011 The Bitcoin developers +// Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2011-2012 The PPCoin developers // Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CHECKPOINT_H #define BITCOIN_CHECKPOINT_H #include +#include "net.h" #include "util.h" -// ppcoin: auto checkpoint min at 8 hours; max at 16 hours -#define AUTO_CHECKPOINT_MIN_SPAN (60 * 60 * 8) -#define AUTO_CHECKPOINT_MAX_SPAN (60 * 60 * 16) -#define AUTO_CHECKPOINT_TRUST_SPAN (60 * 60 * 24) +#define STAKE_MIN_AGE (60 * 60 * 24 * 30) // minimum age 30 days for coin age +#define STAKE_MAX_AGE (60 * 60 * 24 * 90) // stake age for full weight +#define CHECKPOINT_MAX_SPAN (60 * 60 * 4) // max 4 hours before latest block 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& 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(); + void AskForPendingSyncCheckpoint(CNode* pfrom); + bool SetCheckpointPrivKey(std::string strPrivKey); + bool SendSyncCheckpoint(uint256 hashCheckpoint); + bool IsMatureSyncCheckpoint(); +} // ppcoin: synchronized checkpoint class CUnsignedSyncCheckpoint @@ -57,6 +90,7 @@ class CSyncCheckpoint : public CUnsignedSyncCheckpoint { public: static const std::string strMasterPubKey; + static std::string strMasterPrivKey; std::vector vchMsg; std::vector vchSig; @@ -105,41 +139,4 @@ public: 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& mapBlockIndex); - - extern uint256 hashSyncCheckpoint; - extern CSyncCheckpoint checkpointMessage; - extern uint256 hashInvalidCheckpoint; - extern CCriticalSection cs_hashSyncCheckpoint; - - CBlockIndex* GetLastSyncCheckpoint(); - bool AcceptPendingSyncCheckpoint(); - uint256 AutoSelectSyncCheckpoint(); - bool CheckSync(const uint256& hashBlock, const CBlockIndex* pindexPrev); - bool WantedByPendingSyncCheckpoint(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