Skip to content

Commit e545371

Browse files
committed
Merge pull request #6377
c433828 Handle no chain tip available in InvalidChainFound() (Ross Nicoll)
2 parents 41d650f + c433828 commit e545371

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,9 +1228,11 @@ void static InvalidChainFound(CBlockIndex* pindexNew)
12281228
pindexNew->GetBlockHash().ToString(), pindexNew->nHeight,
12291229
log(pindexNew->nChainWork.getdouble())/log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S",
12301230
pindexNew->GetBlockTime()));
1231+
CBlockIndex *tip = chainActive.Tip();
1232+
assert (tip);
12311233
LogPrintf("%s: current best=%s height=%d log2_work=%.8g date=%s\n", __func__,
1232-
chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), log(chainActive.Tip()->nChainWork.getdouble())/log(2.0),
1233-
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()));
1234+
tip->GetBlockHash().ToString(), chainActive.Height(), log(tip->nChainWork.getdouble())/log(2.0),
1235+
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", tip->GetBlockTime()));
12341236
CheckForkWarningConditions();
12351237
}
12361238

0 commit comments

Comments
 (0)