Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 757749d

Browse files
committed
[Fluid] Fix segfault when running reindex
- check for null pointer before using pindexPrev (pointer to previous block)
1 parent fc5cccb commit 757749d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/validation.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,9 +3383,11 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, const CB
33833383

33843384
// Check that all transactions are finalized
33853385
for (const CTransaction& tx : block.vtx) {
3386-
if (!fluid.CheckTransactionToBlock(tx, pindexPrev->GetBlockHeader()))
3387-
return state.DoS(10, error("%s: contains an invalid fluid transaction", __func__), REJECT_INVALID, "invalid-fluid-txns");
3388-
3386+
if (pindexPrev != nullptr) {
3387+
if (!fluid.CheckTransactionToBlock(tx, pindexPrev->GetBlockHeader()))
3388+
return state.DoS(10, error("%s: contains an invalid fluid transaction", __func__), REJECT_INVALID, "invalid-fluid-txns");
3389+
}
3390+
33893391
if (!IsFinalTx(tx, nHeight, nLockTimeCutoff)) {
33903392
return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal");
33913393
}

0 commit comments

Comments
 (0)