aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorjarolrod <jarolrod@tutanota.com>2021-01-06 14:54:22 -0500
committerjarolrod <jarolrod@tutanota.com>2021-01-13 11:22:06 -0500
commitc943282b5e6312537f885c811d43120ce2f5b766 (patch)
tree4308edb123c9305071b382f02a718222499cec1b /src/validation.cpp
parentc17569056105d221053a839d5430df5b3e94f746 (diff)
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.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 2585345dee..7874e5260c 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -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;