Merge pull request #611 from jl777/jl777
similar to the prior fix, if the prevblock is in the limbo state of not being in the mapIndex or not having a pindex, it used to be a severe enough treatment to blacklist the peer. However this seems too strict as with fast block production and uneven block propagation times it seems not impossible that block N+1 arrives at a node before block N does. In such a case, if the blockheaders for N and N+1 have not already been seen, these errors were triggered. The change reduces the reaction from a DoS error blacklist points to simply rejecting the block. If it indeed is a valid block, it will soon arrive and all will be well.
This commit is contained in:
11
src/main.cpp
11
src/main.cpp
@@ -1294,10 +1294,10 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
COutPoint outpoint = tx.vin[i].prevout;
|
COutPoint outpoint = tx.vin[i].prevout;
|
||||||
if (pool.mapNextTx.count(outpoint))
|
if (pool.mapNextTx.count(outpoint))
|
||||||
{
|
{
|
||||||
static uint32_t counter;
|
//static uint32_t counter;
|
||||||
// Disable replacement feature for now
|
// Disable replacement feature for now
|
||||||
//if ( counter++ < 100 )
|
//if ( counter++ < 100 )
|
||||||
fprintf(stderr,"Disable replacement feature for now\n");
|
//fprintf(stderr,"Disable replacement feature for now\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3759,7 +3759,10 @@ bool CheckBlockHeader(int32_t height,CBlockIndex *pindex, const CBlockHeader& bl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (blockhdr.GetBlockTime() > GetAdjustedTime() + 60)
|
if (blockhdr.GetBlockTime() > GetAdjustedTime() + 60)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"future block %u vs time.%u + 60\n",(uint32_t)blockhdr.GetBlockTime(),(uint32_t)GetAdjustedTime());
|
||||||
return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),REJECT_INVALID, "time-too-new");
|
return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),REJECT_INVALID, "time-too-new");
|
||||||
|
}
|
||||||
else if ( ASSETCHAINS_STAKED != 0 && pindex != 0 && pindex->pprev != 0 && pindex->nTime <= pindex->pprev->nTime )
|
else if ( ASSETCHAINS_STAKED != 0 && pindex != 0 && pindex->pprev != 0 && pindex->nTime <= pindex->pprev->nTime )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"ht.%d %u vs ht.%d %u, is not monotonic\n",pindex->nHeight,pindex->nTime,pindex->pprev->nHeight,pindex->pprev->nTime);
|
fprintf(stderr,"ht.%d %u vs ht.%d %u, is not monotonic\n",pindex->nHeight,pindex->nTime,pindex->pprev->nHeight,pindex->pprev->nTime);
|
||||||
@@ -4006,7 +4009,9 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
|
|||||||
BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock);
|
BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock);
|
||||||
if (mi == mapBlockIndex.end())
|
if (mi == mapBlockIndex.end())
|
||||||
{
|
{
|
||||||
return state.DoS(10, error("%s: prev block not found", __func__), 0, "bad-prevblk");
|
fprintf(stderr,"AcceptBlockHeader prev block not found\n");
|
||||||
|
return(false);
|
||||||
|
//return state.DoS(10, error("%s: prev block not found", __func__), 0, "bad-prevblk");
|
||||||
}
|
}
|
||||||
pindexPrev = (*mi).second;
|
pindexPrev = (*mi).second;
|
||||||
if (pindexPrev == 0 )
|
if (pindexPrev == 0 )
|
||||||
|
|||||||
Reference in New Issue
Block a user