Skip to content

Commit 87394b6

Browse files
author
MarcoFalke
committed
Merge #20868: validation: remove redundant check on pindex
c943282 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-ACK c943282 ajtowns: ACK c943282 - code review only MarcoFalke: review ACK c943282 📨 theStack: re-ACK c943282 Tree-SHA512: d2dc58206be61d2897b0703ee93af67abed492a80e84ea03dcfbf7116833173da3bdafa18ff80422d5296729d5254d57cc1db03fdaf817c8f57c62c3abef673c
2 parents 7dc4807 + c943282 commit 87394b6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/validation.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3558,11 +3558,10 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
35583558
// Check for duplicate
35593559
uint256 hash = block.GetHash();
35603560
BlockMap::iterator miSelf = m_block_index.find(hash);
3561-
CBlockIndex *pindex = nullptr;
35623561
if (hash != chainparams.GetConsensus().hashGenesisBlock) {
35633562
if (miSelf != m_block_index.end()) {
35643563
// Block header is already known.
3565-
pindex = miSelf->second;
3564+
CBlockIndex* pindex = miSelf->second;
35663565
if (ppindex)
35673566
*ppindex = pindex;
35683567
if (pindex->nStatus & BLOCK_FAILED_MASK) {
@@ -3631,8 +3630,7 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS
36313630
}
36323631
}
36333632
}
3634-
if (pindex == nullptr)
3635-
pindex = AddToBlockIndex(block);
3633+
CBlockIndex* pindex = AddToBlockIndex(block);
36363634

36373635
if (ppindex)
36383636
*ppindex = pindex;

0 commit comments

Comments
 (0)