Skip to content

Commit 1afc9b0

Browse files
committed
pgreco's startup crash fix
1 parent b5f9b84 commit 1afc9b0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/net_processing.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,10 @@ bool PeerManagerImpl::TipMayBeStale()
910910

911911
bool PeerManagerImpl::CanDirectFetch()
912912
{
913+
if(!m_chainman.ActiveChain().Tip()) {
914+
LogPrint(BCLog::NET, "Startup crash avoided\n");
915+
return false;
916+
}
913917
return m_chainman.ActiveChain().Tip()->GetBlockTime() > GetAdjustedTime() - m_chainparams.GetConsensus().nPowTargetSpacing * 20;
914918
}
915919

0 commit comments

Comments
 (0)