Skip to content

Commit 0fd915e

Browse files
committed
validation: Check GuessVerificationProgress is not called with disconnected block
Use Assume macro as suggested bitcoin/bitcoin#29370 (comment)
1 parent 63e8fc9 commit 0fd915e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/validation.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5286,6 +5286,12 @@ double GuessVerificationProgress(const ChainTxData& data, const CBlockIndex *pin
52865286
if (pindex == nullptr)
52875287
return 0.0;
52885288

5289+
if (!Assume(pindex->nChainTx > 0)) {
5290+
LogWarning("Internal bug detected: block %d has unset nChainTx (%s %s). Please report this issue here: %s\n",
5291+
pindex->nHeight, PACKAGE_NAME, FormatFullVersion(), PACKAGE_BUGREPORT);
5292+
return 0.0;
5293+
}
5294+
52895295
int64_t nNow = time(nullptr);
52905296

52915297
double fTxTotal;

0 commit comments

Comments
 (0)