test
This commit is contained in:
22
src/main.cpp
22
src/main.cpp
@@ -1323,9 +1323,9 @@ bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos, const CMessageHeader::M
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos)
|
||||
bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos,int32_t skipkomodo)
|
||||
{
|
||||
int32_t retval; uint32_t nBits;
|
||||
int32_t retval=0; uint32_t nBits;
|
||||
block.SetNull();
|
||||
|
||||
// Open history file to read
|
||||
@@ -1343,7 +1343,7 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos)
|
||||
|
||||
// Check the header
|
||||
nBits = block.nBits;
|
||||
if ( (retval= komodo_blockcheck(block,&nBits)) == 0 )
|
||||
if ( skipkomodo != 0 || (retval= komodo_blockcheck(block,&nBits)) == 0 )
|
||||
{
|
||||
if (!(CheckEquihashSolution(&block, Params()) && CheckProofOfWork(block.GetHash(), nBits, Params().GetConsensus())))
|
||||
return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());
|
||||
@@ -1353,9 +1353,9 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex)
|
||||
bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,int32_t skipkomodo)
|
||||
{
|
||||
if (!ReadBlockFromDisk(block, pindex->GetBlockPos()))
|
||||
if (!ReadBlockFromDisk(block, pindex->GetBlockPos(),skipkomodo))
|
||||
return false;
|
||||
if (block.GetHash() != pindex->GetBlockHash())
|
||||
return error("ReadBlockFromDisk(CBlock&, CBlockIndex*): GetHash() doesn't match index for %s at %s",
|
||||
@@ -2392,7 +2392,7 @@ bool static DisconnectTip(CValidationState &state) {
|
||||
mempool.check(pcoinsTip);
|
||||
// Read block from disk.
|
||||
CBlock block;
|
||||
if (!ReadBlockFromDisk(block, pindexDelete))
|
||||
if (!ReadBlockFromDisk(block, pindexDelete,0))
|
||||
return AbortNode(state, "Failed to read block");
|
||||
// Apply the block atomically to the chain state.
|
||||
uint256 anchorBeforeDisconnect = pcoinsTip->GetBestAnchor();
|
||||
@@ -2455,7 +2455,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
|
||||
int64_t nTime1 = GetTimeMicros();
|
||||
CBlock block;
|
||||
if (!pblock) {
|
||||
if (!ReadBlockFromDisk(block, pindexNew))
|
||||
if (!ReadBlockFromDisk(block, pindexNew,0))
|
||||
return AbortNode(state, "Failed to read block");
|
||||
pblock = █
|
||||
}
|
||||
@@ -3594,7 +3594,7 @@ bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth
|
||||
break;
|
||||
CBlock block;
|
||||
// check level 0: read from disk
|
||||
if (!ReadBlockFromDisk(block, pindex))
|
||||
if (!ReadBlockFromDisk(block, pindex,0))
|
||||
return error("VerifyDB(): *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
// check level 1: verify block validity
|
||||
if (nCheckLevel >= 1 && !CheckBlock(block, state))
|
||||
@@ -3634,7 +3634,7 @@ bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth
|
||||
uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, 100 - (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * 50))));
|
||||
pindex = chainActive.Next(pindex);
|
||||
CBlock block;
|
||||
if (!ReadBlockFromDisk(block, pindex))
|
||||
if (!ReadBlockFromDisk(block, pindex,0))
|
||||
return error("VerifyDB(): *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
if (!ConnectBlock(block, state, pindex, coins))
|
||||
return error("VerifyDB(): *** found unconnectable block at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
@@ -3807,7 +3807,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
|
||||
std::pair<std::multimap<uint256, CDiskBlockPos>::iterator, std::multimap<uint256, CDiskBlockPos>::iterator> range = mapBlocksUnknownParent.equal_range(head);
|
||||
while (range.first != range.second) {
|
||||
std::multimap<uint256, CDiskBlockPos>::iterator it = range.first;
|
||||
if (ReadBlockFromDisk(block, it->second))
|
||||
if (ReadBlockFromDisk(block, it->second,0))
|
||||
{
|
||||
LogPrintf("%s: Processing out of order child %s of %s\n", __func__, block.GetHash().ToString(),
|
||||
head.ToString());
|
||||
@@ -4166,7 +4166,7 @@ void static ProcessGetData(CNode* pfrom)
|
||||
{
|
||||
// Send block from disk
|
||||
CBlock block;
|
||||
if (!ReadBlockFromDisk(block, (*mi).second))
|
||||
if (!ReadBlockFromDisk(block, (*mi).second,0))
|
||||
assert(!"cannot load block from disk");
|
||||
if (inv.type == MSG_BLOCK)
|
||||
pfrom->PushMessage("block", block);
|
||||
|
||||
Reference in New Issue
Block a user