diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-02-01 10:56:19 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-02-01 10:56:23 +0100 |
commit | 87394b6741df7068eb55d012a8169400c68b34ed (patch) | |
tree | d690001e8cf57d042a5b0a655bea7052168ad14a | |
parent | 7dc4807691b96e53c04ef779501618325a7fafc0 (diff) | |
parent | c943282b5e6312537f885c811d43120ce2f5b766 (diff) |
Merge #20868: validation: remove redundant check on pindex
c943282b5e6312537f885c811d43120ce2f5b766 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 c943282b5e6312537f885c811d43120ce2f5b766 - code review only
MarcoFalke:
review ACK c943282b5e6312537f885c811d43120ce2f5b766 📨
theStack:
re-ACK c943282b5e6312537f885c811d43120ce2f5b766
Tree-SHA512: d2dc58206be61d2897b0703ee93af67abed492a80e84ea03dcfbf7116833173da3bdafa18ff80422d5296729d5254d57cc1db03fdaf817c8f57c62c3abef673c
-rw-r--r-- | src/validation.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index eeb99f0f0a..2aafc0d3fb 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -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; |