mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
Merge #20868: validation: remove redundant check on pindex
c943282b5e
validation: remove redundant check on pindex (jarolrod) Pull request description: This removes a redundant check on `pindex` being a `nullptr`. By the time we get to this step `pindex` is always a `nullptr` as the branch where it has been set would have already returned. Closes #19223 ACKs for top commit: Zero-1729: re-ACKc943282
ajtowns: ACKc943282b5e
- code review only MarcoFalke: review ACKc943282b5e
📨 theStack: re-ACKc943282b5e
Tree-SHA512: d2dc58206be61d2897b0703ee93af67abed492a80e84ea03dcfbf7116833173da3bdafa18ff80422d5296729d5254d57cc1db03fdaf817c8f57c62c3abef673c
This commit is contained in:
commit
87394b6741
1 changed files with 2 additions and 4 deletions
|
@ -3558,11 +3558,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) {
|
||||
|
@ -3631,8 +3630,7 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
|
|||
}
|
||||
}
|
||||
}
|
||||
if (pindex == nullptr)
|
||||
pindex = AddToBlockIndex(block);
|
||||
CBlockIndex* pindex = AddToBlockIndex(block);
|
||||
|
||||
if (ppindex)
|
||||
*ppindex = pindex;
|
||||
|
|
Loading…
Reference in a new issue