Add support for out of order blocks and tolerance for future stamped blocks
In order to speed up block propagation, it is possible for some blocks to arrive out of order due to propagation delays combined with 2 or more blocks mined very quickly. Additionally futurestamping blocks allows a high hash rate miner to produce blocks that would be valid after a passage of time. Previously such blocks triggered an extreme response that banned the peer that broadcast it. Since these are temporary issues, if the block is still valid when it is within the allowed timestamp window, this update will process it normally.
This commit is contained in:
@@ -267,7 +267,7 @@ UniValue generate(const UniValue& params, bool fHelp)
|
||||
}
|
||||
endloop:
|
||||
CValidationState state;
|
||||
if (!ProcessNewBlock(chainActive.Tip()->nHeight+1,state, NULL, pblock, true, NULL))
|
||||
if (!ProcessNewBlock(1,chainActive.Tip()->nHeight+1,state, NULL, pblock, true, NULL))
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted");
|
||||
++nHeight;
|
||||
blockHashes.push_back(pblock->GetHash().GetHex());
|
||||
@@ -807,7 +807,7 @@ UniValue submitblock(const UniValue& params, bool fHelp)
|
||||
CValidationState state;
|
||||
submitblock_StateCatcher sc(block.GetHash());
|
||||
RegisterValidationInterface(&sc);
|
||||
bool fAccepted = ProcessNewBlock(chainActive.Tip()->nHeight+1,state, NULL, &block, true, NULL);
|
||||
bool fAccepted = ProcessNewBlock(1,chainActive.Tip()->nHeight+1,state, NULL, &block, true, NULL);
|
||||
UnregisterValidationInterface(&sc);
|
||||
if (fBlockPresent)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user