Trying to fix the forking issue, which is now clearly a bug in sending and receiving headers. This checkin will enable debugging and may be a fix.

This commit is contained in:
Michael Toutonghi
2018-05-15 22:19:07 -07:00
parent 32430433f3
commit 3da69a3138
3 changed files with 45 additions and 39 deletions

View File

@@ -3999,7 +3999,6 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
{
const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1;
const Consensus::Params& consensusParams = Params().GetConsensus();
bool checkBlockOne = (nHeight == 1);
// Check that all transactions are finalized
BOOST_FOREACH(const CTransaction& tx, block.vtx) {
@@ -4087,7 +4086,7 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat
komodo_requestedhash = block.hashPrevBlock;
komodo_requestedcount = 0;
}*/
LogPrintf("AcceptBlockHeader hashPrevBlock %s not found\n",block.hashPrevBlock.ToString().c_str());
LogPrintf("AcceptBlockHeader %s\n hashPrevBlock %s not found\n", hash.ToString().c_str(), block.hashPrevBlock.ToString().c_str());
return(false);
//return state.DoS(10, error("%s: prev block not found", __func__), 0, "bad-prevblk");
}
@@ -6016,8 +6015,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
pindex = chainActive.Next(pindex);
}
// we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end
vector<CBlock> vHeaders;
// we should probably use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end
vector<CBlockHeader> vHeaders;
int nLimit = MAX_HEADERS_RESULTS;
LogPrint("net", "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString(), pfrom->id);
//if ( pfrom->lasthdrsreq >= chainActive.Height()-MAX_HEADERS_RESULTS || pfrom->lasthdrsreq != (int32_t)(pindex ? pindex->nHeight : -1) )// no need to ever suppress this