X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fmain.h;h=328b321b13d2eb79d29fee71720d3a1f4c9be25e;hb=adb8391acdf671640adb1e8be564e68b254fca69;hp=d6eb8cfcc7dad6f5344ccdb59ccbe004c6a24840;hpb=74a7badde0d9ba0a888d30b46133de50a5267f61;p=novacoin.git diff --git a/src/main.h b/src/main.h index d6eb8cf..328b321 100644 --- a/src/main.h +++ b/src/main.h @@ -9,7 +9,7 @@ #include "sync.h" #include "net.h" #include "script.h" -#include "scrypt_mine.h" +#include "scrypt.h" #include @@ -80,8 +80,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; @@ -91,6 +89,7 @@ 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; @@ -112,13 +111,14 @@ void PrintBlockTree(); 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 CheckStake(CBlock* pblock, CWallet& wallet); + +// 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 ExternalBlockFileProgress; +bool LoadExternalBlockFile(FILE* fileIn, ExternalBlockFileProgress *progress=NULL); + 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); @@ -129,7 +129,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(); @@ -912,14 +912,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