mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
merge bitcoin#15999: Remove dead code in LoadChainTip
This commit is contained in:
parent
8dbf26e737
commit
51f73b558f
@ -4349,20 +4349,10 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams) EXCLUSIVE_LOCKS_RE
|
|||||||
bool LoadChainTip(const CChainParams& chainparams)
|
bool LoadChainTip(const CChainParams& chainparams)
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
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 (::ChainActive().Tip() && ::ChainActive().Tip()->GetBlockHash() == pcoinsTip->GetBestBlock()) return true;
|
||||||
|
|
||||||
if (pcoinsTip->GetBestBlock().IsNull() && ::BlockIndex().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
|
// Load pointer to end of best chain
|
||||||
CBlockIndex* pindex = LookupBlockIndex(pcoinsTip->GetBestBlock());
|
CBlockIndex* pindex = LookupBlockIndex(pcoinsTip->GetBestBlock());
|
||||||
if (!pindex) {
|
if (!pindex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user