Merge 74fb19317a into merged_master (Bitcoin PR bitcoin/bitcoin#30849)

This commit is contained in:
Tom Trevethan 2026-03-31 22:40:02 +01:00
commit a7e8a376fa
17 changed files with 106 additions and 135 deletions

View file

@ -189,17 +189,14 @@ std::optional<std::vector<int>> CalculatePrevHeights(
prev_heights[i] = -1;
continue;
}
Coin coin;
if (!coins.GetCoin(txin.prevout, coin)) {
if (auto coin{coins.GetCoin(txin.prevout)}) {
prev_heights[i] = coin->nHeight == MEMPOOL_HEIGHT
? tip.nHeight + 1 // Assume all mempool transaction confirm in the next block.
: coin->nHeight;
} else {
LogPrintf("ERROR: %s: Missing input %d in transaction \'%s\'\n", __func__, i, tx.GetHash().GetHex());
return std::nullopt;
}
if (coin.nHeight == MEMPOOL_HEIGHT) {
// Assume all mempool transaction confirm in the next block.
prev_heights[i] = tip.nHeight + 1;
} else {
prev_heights[i] = coin.nHeight;
}
}
return prev_heights;
}