X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fmain.h;h=13974f92c811ad40218340262cac3215bacb189b;hb=de71734ac41eebfe8763ce34e0443d64ea4aacc9;hp=6c53c7687798093c793a072befcb50e1e5c30abd;hpb=9b1c1c96d205849f993eaa23a6c0a3ab947e110d;p=novacoin.git diff --git a/src/main.h b/src/main.h index 6c53c76..13974f9 100644 --- a/src/main.h +++ b/src/main.h @@ -86,6 +86,7 @@ class CTxIndex; void RegisterWallet(CWallet* pwalletIn); void UnregisterWallet(CWallet* pwalletIn); +bool ProcessBlock(CNode* pfrom, CBlock* pblock); bool CheckDiskSpace(uint64 nAdditionalBytes=0); FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb"); FILE* AppendBlockFile(unsigned int& nFileRet); @@ -99,7 +100,8 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& 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); -int GetTotalBlocksEstimate(); +unsigned int ComputeMinWork(unsigned int nBase, int64 nTime); +int GetNumBlocksOfPeers(); bool IsInitialBlockDownload(); std::string GetWarnings(std::string strFor); @@ -400,6 +402,9 @@ public: std::vector vout; unsigned int nLockTime; + // Denial-of-service detection: + mutable int nDoS; + bool DoS(int nDoSIn, bool fIn) const { nDoS += nDoSIn; return fIn; } CTransaction() { @@ -421,6 +426,7 @@ public: vin.clear(); vout.clear(); nLockTime = 0; + nDoS = 0; // Denial-of-service prevention } bool IsNull() const @@ -787,6 +793,9 @@ public: // memory only mutable std::vector vMerkleTree; + // Denial-of-service detection: + mutable int nDoS; + bool DoS(int nDoSIn, bool fIn) const { nDoS += nDoSIn; return fIn; } CBlock() { @@ -820,6 +829,7 @@ public: nNonce = 0; vtx.clear(); vMerkleTree.clear(); + nDoS = 0; } bool IsNull() const @@ -918,7 +928,7 @@ public: fflush(fileout); if (!IsInitialBlockDownload() || (nBestHeight+1) % 500 == 0) { -#ifdef __WXMSW__ +#ifdef WIN32 _commit(_fileno(fileout)); #else fsync(fileno(fileout));