aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-05-17 07:22:48 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-05-17 07:22:52 -0400
commita822a0e4f6317f98cde6f0d5abe952b4e8992ac9 (patch)
tree3544c3c9654004f5d0403b4756b36112d99e19e9 /src/validation.cpp
parentf3d27d126bbf50e0ba63f295bfa44e4554d48343 (diff)
parentfa86c8aec611a9b9d2f53960c92419cf2a8bb92d (diff)
Merge #15999: init: Remove dead code in LoadChainTip
fa86c8aec6 init: Remove dead code in LoadChainTip (MarcoFalke) Pull request description: `LoadChainTip` sets `::ChainActive()` based on `pcoinsTip`'s best block. `LoadChainTip` is never called when that block is null, so we can remove all code from within that method that is only executed when that block is null. Fixes #15967 Inconsistent locking behavior in LoadChainTip ACKs for commit fa86c8: promag: utACK fa86c8aec611a9b9d2f53960c92419cf2a8bb92d. practicalswift: utACK fa86c8aec611a9b9d2f53960c92419cf2a8bb92d Empact: utACK https://github.com/bitcoin/bitcoin/pull/15999/commits/fa86c8aec611a9b9d2f53960c92419cf2a8bb92d laanwj: utACK fa86c8aec611a9b9d2f53960c92419cf2a8bb92d ryanofsky: utACK fa86c8aec611a9b9d2f53960c92419cf2a8bb92d. LoadChainTip isn't called currently when pcoinsTip best block is null due to this line: jamesob: utACK https://github.com/bitcoin/bitcoin/pull/15999/commits/fa86c8aec611a9b9d2f53960c92419cf2a8bb92d Tree-SHA512: 8961c0e579800a52038ac5655478468852faac055299b64d6cfdf0c213d3bf09669c4889467d09d93457f6c8b073967bb0475a137f77ddd3a3a3c03ad90001c4
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index dcd2350fd8..b2d84f4c95 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3951,20 +3951,10 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams) EXCLUSIVE_LOCKS_RE
bool LoadChainTip(const CChainParams& chainparams)
{
AssertLockHeld(cs_main);
+ assert(!pcoinsTip->GetBestBlock().IsNull()); // Never called when the coins view is empty
if (::ChainActive().Tip() && ::ChainActive().Tip()->GetBlockHash() == pcoinsTip->GetBestBlock()) return true;
- if (pcoinsTip->GetBestBlock().IsNull() && mapBlockIndex.size() == 1) {
- // In case we just added the genesis block, connect it now, so
- // that we always have a ::ChainActive().Tip() when we return.
- LogPrintf("%s: Connecting genesis block...\n", __func__);
- CValidationState state;
- if (!ActivateBestChain(state, chainparams)) {
- LogPrintf("%s: failed to activate chain (%s)\n", __func__, FormatStateMessage(state));
- return false;
- }
- }
-
// Load pointer to end of best chain
CBlockIndex* pindex = LookupBlockIndex(pcoinsTip->GetBestBlock());
if (!pindex) {