mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-30 16:54:19 +00:00
Merge pull request #6299
4f40716 test: Move reindex test to standard tests (Wladimir J. van der Laan) 36c97b4 Bugfix: Don't check the genesis block header before accepting it (Jorge Timón)
This commit is contained in:
commit
24f24896d6
@ -34,6 +34,7 @@ testScripts=(
|
|||||||
'signrawtransactions.py'
|
'signrawtransactions.py'
|
||||||
'walletbackup.py'
|
'walletbackup.py'
|
||||||
'nodehandling.py'
|
'nodehandling.py'
|
||||||
|
'reindex.py'
|
||||||
);
|
);
|
||||||
testScriptsExt=(
|
testScriptsExt=(
|
||||||
'bipdersig-p2p.py'
|
'bipdersig-p2p.py'
|
||||||
@ -45,7 +46,6 @@ testScriptsExt=(
|
|||||||
'invalidateblock.py'
|
'invalidateblock.py'
|
||||||
'keypool.py'
|
'keypool.py'
|
||||||
'receivedby.py'
|
'receivedby.py'
|
||||||
'reindex.py'
|
|
||||||
'rpcbind_test.py'
|
'rpcbind_test.py'
|
||||||
# 'script_test.py'
|
# 'script_test.py'
|
||||||
'smartfees.py'
|
'smartfees.py'
|
||||||
|
@ -2810,6 +2810,8 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
|
|||||||
uint256 hash = block.GetHash();
|
uint256 hash = block.GetHash();
|
||||||
BlockMap::iterator miSelf = mapBlockIndex.find(hash);
|
BlockMap::iterator miSelf = mapBlockIndex.find(hash);
|
||||||
CBlockIndex *pindex = NULL;
|
CBlockIndex *pindex = NULL;
|
||||||
|
if (hash != chainparams.GetConsensus().hashGenesisBlock) {
|
||||||
|
|
||||||
if (miSelf != mapBlockIndex.end()) {
|
if (miSelf != mapBlockIndex.end()) {
|
||||||
// Block header is already known.
|
// Block header is already known.
|
||||||
pindex = miSelf->second;
|
pindex = miSelf->second;
|
||||||
@ -2825,21 +2827,20 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
|
|||||||
|
|
||||||
// Get prev block index
|
// Get prev block index
|
||||||
CBlockIndex* pindexPrev = NULL;
|
CBlockIndex* pindexPrev = NULL;
|
||||||
if (hash != chainparams.GetConsensus().hashGenesisBlock) {
|
|
||||||
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");
|
return state.DoS(10, error("%s: prev block not found", __func__), 0, "bad-prevblk");
|
||||||
pindexPrev = (*mi).second;
|
pindexPrev = (*mi).second;
|
||||||
if (pindexPrev->nStatus & BLOCK_FAILED_MASK)
|
if (pindexPrev->nStatus & BLOCK_FAILED_MASK)
|
||||||
return state.DoS(100, error("%s: prev block invalid", __func__), REJECT_INVALID, "bad-prevblk");
|
return state.DoS(100, error("%s: prev block invalid", __func__), REJECT_INVALID, "bad-prevblk");
|
||||||
}
|
|
||||||
assert(pindexPrev);
|
assert(pindexPrev);
|
||||||
if (fCheckpointsEnabled && !CheckIndexAgainstCheckpoint(pindexPrev, state, chainparams, hash))
|
if (fCheckpointsEnabled && !CheckIndexAgainstCheckpoint(pindexPrev, state, chainparams, hash))
|
||||||
return error("%s: CheckIndexAgainstCheckpoint(): %s", __func__, state.GetRejectReason().c_str());
|
return error("%s: CheckIndexAgainstCheckpoint(): %s", __func__, state.GetRejectReason().c_str());
|
||||||
|
|
||||||
if (!ContextualCheckBlockHeader(block, state, pindexPrev))
|
if (!ContextualCheckBlockHeader(block, state, pindexPrev))
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (pindex == NULL)
|
if (pindex == NULL)
|
||||||
pindex = AddToBlockIndex(block);
|
pindex = AddToBlockIndex(block);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user