Merge branch 'dev' of https://github.com/jl777/komodo into trunk-merge

* 'dev' of https://github.com/jl777/komodo: (1062 commits)
  Delay PoW check until connect block
  Declare
  KOMODO_NEWBLOCKS
  Prevent autorewind if syncing. Not a critical update
  Change n0/n1 size to int32_t
  Syntax
  Fix n -> static n0/n1
  Test
  Test
  Test
  KOMODO_LONGESTCHAIN = height;
  Sync main.cpp to jl777
  -print
  -USD/EUR
  readme
  curl fix
  -print
  Fix buffer overflows and reduce KMD men usage
  -print
  Test
  ...
This commit is contained in:
Scott Grayson
2018-04-15 21:59:37 -04:00
913 changed files with 112652 additions and 11809 deletions

View File

@@ -70,6 +70,9 @@ void static BatchWriteHashBestAnchor(CLevelDBBatch &batch, const uint256 &hash)
batch.Write(DB_BEST_ANCHOR, hash);
}
CCoinsViewDB::CCoinsViewDB(std::string dbName, size_t nCacheSize, bool fMemory, bool fWipe) : db(GetDataDir() / dbName, nCacheSize, fMemory, fWipe) {
}
CCoinsViewDB::CCoinsViewDB(size_t nCacheSize, bool fMemory, bool fWipe) : db(GetDataDir() / "chainstate", nCacheSize, fMemory, fWipe, false, 64) {
}
@@ -510,12 +513,21 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
pindexNew->nVersion = diskindex.nVersion;
pindexNew->hashReserved = diskindex.hashReserved;
pindexNew->hashMerkleRoot = diskindex.hashMerkleRoot;
pindexNew->hashReserved = diskindex.hashReserved;
pindexNew->nTime = diskindex.nTime;
pindexNew->nBits = diskindex.nBits;
pindexNew->nNonce = diskindex.nNonce;
pindexNew->nSolution = diskindex.nSolution;
pindexNew->nStatus = diskindex.nStatus;
pindexNew->nCachedBranchId = diskindex.nCachedBranchId;
pindexNew->nTx = diskindex.nTx;
pindexNew->nSproutValue = diskindex.nSproutValue;
// Consistency checks
auto header = pindexNew->GetBlockHeader();
if (header.GetHash() != pindexNew->GetBlockHash())
return error("LoadBlockIndex(): block header inconsistency detected: on-disk = %s, in-memory = %s",
diskindex.ToString(), pindexNew->ToString());
uint8_t pubkey33[33];
komodo_index2pubkey33(pubkey33,pindexNew,pindexNew->nHeight);
if (!CheckProofOfWork(pindexNew->nHeight,pubkey33,pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus()))