#include "net.h"
#include "script.h"
#include "scrypt.h"
+#include "zerocoin/Zerocoin.h"
#include <list>
static const uint256 hashGenesisBlock("0x00000a060336cbb72fe969666d337b87198b1add2abaa59cca226820b32933a4");
static const uint256 hashGenesisBlockTestNet("0x000c763e402f2436da9ed36c7286f62c3f6e5dbafce9ff289bd43d7459327eb");
-
static const int64 nMaxClockDrift = 2 * 60 * 60; // two hours
+extern libzerocoin::Params* ZCParams;
extern CScript COINBASE_FLAGS;
-
-
extern CCriticalSection cs_main;
extern std::map<uint256, CBlockIndex*> mapBlockIndex;
extern std::set<std::pair<COutPoint, unsigned int> > setStakeSeen;
// Settings
extern int64 nTransactionFee;
-extern bool fStakeUsePooledKeys;
+extern int64 nMinimumInputValue;
+extern bool fUseFastIndex;
extern unsigned int nDerivationMethodIndex;
// Minimum disk space required - used in CheckDiskSpace()
static const uint64 nMinDiskSpace = 52428800;
-
class CReserveKey;
class CTxDB;
class CTxIndex;
CBlockIndex* FindBlockByHeight(int nHeight);
bool ProcessMessages(CNode* pfrom);
bool SendMessages(CNode* pto, bool fSendTrickle);
-
-// Processes a blk*.dat file and fires the given signal to indicate how far
-// through the file the load has reached, if provided.
-typedef boost::signals2::signal<void (unsigned int bytesRead)> ExternalBlockFileProgress;
-bool LoadExternalBlockFile(FILE* fileIn, ExternalBlockFileProgress *progress=NULL);
+bool LoadExternalBlockFile(FILE* fileIn);
bool CheckProofOfWork(uint256 hash, unsigned int nBits);
unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake);
return dPriority > COIN * 144 / 250;
}
- int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=false, enum GetMinFee_mode mode=GMF_BLOCK) const;
+ int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=false, enum GetMinFee_mode mode=GMF_BLOCK, unsigned int nBytes = 0) const;
bool ReadFromDisk(CDiskTxPos pos, FILE** pfileRet=NULL)
{
/** Used to marshal pointers into hashes for db storage. */
class CDiskBlockIndex : public CBlockIndex
{
+private:
+ uint256 blockHash;
+
public:
uint256 hashPrev;
uint256 hashNext;
{
hashPrev = 0;
hashNext = 0;
+ blockHash = 0;
}
explicit CDiskBlockIndex(CBlockIndex* pindex) : CBlockIndex(*pindex)
READWRITE(nTime);
READWRITE(nBits);
READWRITE(nNonce);
+ READWRITE(blockHash);
)
uint256 GetBlockHash() const
{
+ if (fUseFastIndex && (nTime < GetAdjustedTime() - 12 * nMaxClockDrift) && blockHash != 0)
+ return blockHash;
+
CBlock block;
block.nVersion = nVersion;
block.hashPrevBlock = hashPrev;
block.nTime = nTime;
block.nBits = nBits;
block.nNonce = nNonce;
- return block.GetHash();
- }
+ const_cast<CDiskBlockIndex*>(this)->blockHash = block.GetHash();
+
+ return blockHash;
+ }
std::string ToString() const
{