Fix getblocktemplate

This commit is contained in:
jl777
2018-04-16 07:41:57 +03:00
parent d4ae49affd
commit 455ba30411
2 changed files with 4 additions and 4 deletions

View File

@@ -2923,7 +2923,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
LogPrint("bench", " - Load block from disk: %.2fms [%.2fs]\n", (nTime2 - nTime1) * 0.001, nTimeReadFromDisk * 0.000001); LogPrint("bench", " - Load block from disk: %.2fms [%.2fs]\n", (nTime2 - nTime1) * 0.001, nTimeReadFromDisk * 0.000001);
{ {
CCoinsViewCache view(pcoinsTip); CCoinsViewCache view(pcoinsTip);
bool rv = ConnectBlock(*pblock, state, pindexNew, view); bool rv = ConnectBlock(*pblock, state, pindexNew, view,false,true);
GetMainSignals().BlockChecked(*pblock, state); GetMainSignals().BlockChecked(*pblock, state);
if (!rv) { if (!rv) {
if (state.IsInvalid()) if (state.IsInvalid())
@@ -3977,7 +3977,7 @@ bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex
fprintf(stderr,"TestBlockValidity failure C\n"); fprintf(stderr,"TestBlockValidity failure C\n");
return false; return false;
} }
if (!ConnectBlock(block, state, &indexDummy, viewNew, true)) if (!ConnectBlock(block, state, &indexDummy, viewNew, true,fCheckPOW))
{ {
//fprintf(stderr,"TestBlockValidity failure D\n"); //fprintf(stderr,"TestBlockValidity failure D\n");
return false; return false;
@@ -4415,7 +4415,7 @@ bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth
CBlock block; CBlock block;
if (!ReadBlockFromDisk(block, pindex)) if (!ReadBlockFromDisk(block, pindex))
return error("VerifyDB(): *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); return error("VerifyDB(): *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
if (!ConnectBlock(block, state, pindex, coins)) if (!ConnectBlock(block, state, pindex, coins,false,true))
return error("VerifyDB(): *** found unconnectable block at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); return error("VerifyDB(): *** found unconnectable block at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
} }
} }

View File

@@ -447,7 +447,7 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex);
bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins, bool* pfClean = NULL); bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins, bool* pfClean = NULL);
/** Apply the effects of this block (with given index) on the UTXO set represented by coins */ /** Apply the effects of this block (with given index) on the UTXO set represented by coins */
bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins, bool fJustCheck = false); bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins, bool fJustCheck = false,bool fCheckPOW = false);
/** Context-independent validity checks */ /** Context-independent validity checks */
bool CheckBlockHeader(int32_t height,CBlockIndex *pindex,const CBlockHeader& block, CValidationState& state, bool fCheckPOW = true); bool CheckBlockHeader(int32_t height,CBlockIndex *pindex,const CBlockHeader& block, CValidationState& state, bool fCheckPOW = true);