Add context flag to stop checking twice
This commit is contained in:
@@ -102,6 +102,9 @@ enum BlockStatus: uint32_t {
|
|||||||
//! Scripts & signatures ok. Implies all parents are also at least SCRIPTS.
|
//! Scripts & signatures ok. Implies all parents are also at least SCRIPTS.
|
||||||
BLOCK_VALID_SCRIPTS = 5,
|
BLOCK_VALID_SCRIPTS = 5,
|
||||||
|
|
||||||
|
// flag to check if contextual check block has passed in Accept block, if it has not check at connect block.
|
||||||
|
BLOCK_VALID_CONTEXT = 6,
|
||||||
|
|
||||||
//! All validity bits.
|
//! All validity bits.
|
||||||
BLOCK_VALID_MASK = BLOCK_VALID_HEADER | BLOCK_VALID_TREE | BLOCK_VALID_TRANSACTIONS |
|
BLOCK_VALID_MASK = BLOCK_VALID_HEADER | BLOCK_VALID_TREE | BLOCK_VALID_TRANSACTIONS |
|
||||||
BLOCK_VALID_CHAIN | BLOCK_VALID_SCRIPTS,
|
BLOCK_VALID_CHAIN | BLOCK_VALID_SCRIPTS,
|
||||||
|
|||||||
20
src/main.cpp
20
src/main.cpp
@@ -3274,14 +3274,17 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
//fprintf(stderr,"checkblock failure in connectblock futureblock.%d\n",futureblock);
|
//fprintf(stderr,"checkblock failure in connectblock futureblock.%d\n",futureblock);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check pindex->CONTEXT_VALIDATED flag
|
if ( fCheckPOW != 0 && (pindex->nStatus & BLOCK_VALID_CONTEXT) != BLOCK_VALID_CONTEXT ) // Activate Jan 15th, 2019
|
||||||
if ( fCheckPOW != 0 && !ContextualCheckBlock(block, state, pindex->pprev) ) // Activate Jan 15th, 2019
|
|
||||||
{
|
{
|
||||||
fprintf(stderr,"ContextualCheckBlock failed ht.%d\n",(int32_t)pindex->GetHeight());
|
if ( !ContextualCheckBlock(block, state, pindex->pprev) )
|
||||||
if ( pindex->nTime > 1547510400 )
|
{
|
||||||
return false;
|
fprintf(stderr,"ContextualCheckBlock failed ht.%d\n",(int32_t)pindex->GetHeight());
|
||||||
fprintf(stderr,"grandfathered exception, until jan 15th 2019\n");
|
if ( pindex->nTime > 1547510400 )
|
||||||
|
return false;
|
||||||
|
fprintf(stderr,"grandfathered exception, until jan 15th 2019\n");
|
||||||
|
} else pindex->nStatus |= BLOCK_VALID_CONTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do this here before the block is moved to the main block files.
|
// Do this here before the block is moved to the main block files.
|
||||||
if ( ASSETCHAINS_NOTARY_PAY[0] != 0 && pindex->GetHeight() > 10 )
|
if ( ASSETCHAINS_NOTARY_PAY[0] != 0 && pindex->GetHeight() > 10 )
|
||||||
{
|
{
|
||||||
@@ -5340,7 +5343,8 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C
|
|||||||
|
|
||||||
// See method docstring for why this is always disabled
|
// See method docstring for why this is always disabled
|
||||||
auto verifier = libzcash::ProofVerifier::Disabled();
|
auto verifier = libzcash::ProofVerifier::Disabled();
|
||||||
if ((!CheckBlock(futureblockp,pindex->GetHeight(),pindex,block, state, verifier,0)) || !ContextualCheckBlock(block, state, pindex->pprev))
|
bool fContextualCheckBlock = ContextualCheckBlock(block, state, pindex->pprev);
|
||||||
|
if ( (!CheckBlock(futureblockp,pindex->GetHeight(),pindex,block, state, verifier,0)) || !fContextualCheckBlock )
|
||||||
{
|
{
|
||||||
static int32_t saplinght = -1;
|
static int32_t saplinght = -1;
|
||||||
CBlockIndex *tmpptr;
|
CBlockIndex *tmpptr;
|
||||||
@@ -5365,6 +5369,8 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( fContextualCheckBlock )
|
||||||
|
pindex->nStatus |= BLOCK_VALID_CONTEXT;
|
||||||
|
|
||||||
int nHeight = pindex->GetHeight();
|
int nHeight = pindex->GetHeight();
|
||||||
// Temp File fix. LABS has been using this for ages with no bad effects.
|
// Temp File fix. LABS has been using this for ages with no bad effects.
|
||||||
|
|||||||
Reference in New Issue
Block a user