X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fmain.h;h=8b57cd458429cb3f369ffbccf85d7575b0a92d23;hb=af1b5b2c9471be320ee44b6ec030434e0626571d;hp=08385c00b3ec35c8a777cd33a6e34f00eaee9e47;hpb=68da523f62e250e978dd996aae941f66cbb0fb0a;p=novacoin.git diff --git a/src/main.h b/src/main.h index 08385c0..8b57cd4 100644 --- a/src/main.h +++ b/src/main.h @@ -9,7 +9,8 @@ #include "sync.h" #include "net.h" #include "script.h" -#include "scrypt_mine.h" +#include "scrypt.h" +#include "zerocoin/Zerocoin.h" #include @@ -57,12 +58,10 @@ static const int fHaveUPnP = false; 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 mapBlockIndex; extern std::set > setStakeSeen; @@ -80,8 +79,6 @@ extern uint64 nLastBlockTx; extern uint64 nLastBlockSize; extern int64 nLastCoinStakeSearchInterval; extern const std::string strMessageMagic; -extern double dHashesPerSec; -extern int64 nHPSTimerStart; extern int64 nTimeBestReceived; extern CCriticalSection cs_setpwalletRegistered; extern std::set setpwalletRegistered; @@ -90,11 +87,12 @@ extern std::map mapOrphanBlocks; // Settings extern int64 nTransactionFee; +extern bool fStakeUsePooledKeys; +extern unsigned int nDerivationMethodIndex; // Minimum disk space required - used in CheckDiskSpace() static const uint64 nMinDiskSpace = 52428800; - class CReserveKey; class CTxDB; class CTxIndex; @@ -112,11 +110,9 @@ CBlockIndex* FindBlockByHeight(int nHeight); bool ProcessMessages(CNode* pfrom); bool SendMessages(CNode* pto, bool fSendTrickle); bool LoadExternalBlockFile(FILE* fileIn); -CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake=false); -void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce); -void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1); -bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey); + bool CheckProofOfWork(uint256 hash, unsigned int nBits); +unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake); int64 GetProofOfWorkReward(unsigned int nBits); int64 GetProofOfStakeReward(int64 nCoinAge, unsigned int nBits, unsigned int nTime, bool bCoinYearOnly=false); unsigned int ComputeMinWork(unsigned int nBase, int64 nTime); @@ -127,7 +123,7 @@ std::string GetWarnings(std::string strFor); bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock); uint256 WantedByOrphan(const CBlock* pblockOrphan); const CBlockIndex* GetLastBlockIndex(const CBlockIndex* pindex, bool fProofOfStake); -void BitcoinMiner(CWallet *pwallet, bool fProofOfStake); +void StakeMiner(CWallet *pwallet); void ResendWalletTransactions(); @@ -535,7 +531,7 @@ public: bool IsCoinStake() const { // ppcoin: the coin stake transaction is marked with the first output empty - return (vin.size() > 0 && (!vin[0].prevout.IsNull()) && vout.size() >= 2 && vout[0].IsEmpty()); + return (vin.size() > 0 && (!vin[0].prevout.IsNull()) && vout.size() >= 2 && vout[0].IsEmpty() && !vout[1].IsEmpty()); } /** Check for standard transaction types @@ -910,14 +906,7 @@ public: uint256 GetHash() const { - uint256 thash; - void * scratchbuff = scrypt_buffer_alloc(); - - scrypt_hash(CVOIDBEGIN(nVersion), sizeof(block_header), UINTBEGIN(thash), scratchbuff); - - scrypt_buffer_free(scratchbuff); - - return thash; + return scrypt_blockhash(CVOIDBEGIN(nVersion)); } int64 GetBlockTime() const