mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
validation: remove redundant check on pindex
This removes a conditional that checks if pindex is equal to nullptr. This check is redundant because the branch where pindex is set returns at an earlier time. Additionaly, The independence of the earlier and later pindex is made clearer.
This commit is contained in:
parent
c175690561
commit
c943282b5e
1 changed files with 2 additions and 4 deletions
|
@ -3548,11 +3548,10 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
|
|||
// Check for duplicate
|
||||
uint256 hash = block.GetHash();
|
||||
BlockMap::iterator miSelf = m_block_index.find(hash);
|
||||
CBlockIndex *pindex = nullptr;
|
||||
if (hash != chainparams.GetConsensus().hashGenesisBlock) {
|
||||
if (miSelf != m_block_index.end()) {
|
||||
// Block header is already known.
|
||||
pindex = miSelf->second;
|
||||
CBlockIndex* pindex = miSelf->second;
|
||||
if (ppindex)
|
||||
*ppindex = pindex;
|
||||
if (pindex->nStatus & BLOCK_FAILED_MASK) {
|
||||
|
@ -3621,8 +3620,7 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
|
|||
}
|
||||
}
|
||||
}
|
||||
if (pindex == nullptr)
|
||||
pindex = AddToBlockIndex(block);
|
||||
CBlockIndex* pindex = AddToBlockIndex(block);
|
||||
|
||||
if (ppindex)
|
||||
*ppindex = pindex;
|
||||
|
|
Loading…
Add table
Reference in a new issue