Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | if (useExistingLockPoints) { | ||||
} | } | ||||
if (coin.GetHeight() == MEMPOOL_HEIGHT) { | if (coin.GetHeight() == MEMPOOL_HEIGHT) { | ||||
// Assume all mempool transaction confirm in the next block | // Assume all mempool transaction confirm in the next block | ||||
prevheights[txinIndex] = tip->nHeight + 1; | prevheights[txinIndex] = tip->nHeight + 1; | ||||
} else { | } else { | ||||
prevheights[txinIndex] = coin.GetHeight(); | prevheights[txinIndex] = coin.GetHeight(); | ||||
} | } | ||||
} | } | ||||
lockPair = CalculateSequenceLocks(tx, flags, &prevheights, index); | lockPair = CalculateSequenceLocks(tx, flags, prevheights, index); | ||||
if (lp) { | if (lp) { | ||||
lp->height = lockPair.first; | lp->height = lockPair.first; | ||||
lp->time = lockPair.second; | lp->time = lockPair.second; | ||||
// Also store the hash of the block with the highest height of all | // Also store the hash of the block with the highest height of all | ||||
// the blocks which have sequence locked prevouts. This hash needs | // the blocks which have sequence locked prevouts. This hash needs | ||||
// to still be on the chain for these LockPoint calculations to be | // to still be on the chain for these LockPoint calculations to be | ||||
// valid. | // valid. | ||||
// Note: It is impossible to correctly calculate a maxInputBlock if | // Note: It is impossible to correctly calculate a maxInputBlock if | ||||
▲ Show 20 Lines • Show All 1,518 Lines • ▼ Show 20 Lines | for (const auto &ptx : block.vtx) { | ||||
// Check that transaction is BIP68 final BIP68 lock checks (as | // Check that transaction is BIP68 final BIP68 lock checks (as | ||||
// opposed to nLockTime checks) must be in ConnectBlock because they | // opposed to nLockTime checks) must be in ConnectBlock because they | ||||
// require the UTXO set. | // require the UTXO set. | ||||
prevheights.resize(tx.vin.size()); | prevheights.resize(tx.vin.size()); | ||||
for (size_t j = 0; j < tx.vin.size(); j++) { | for (size_t j = 0; j < tx.vin.size(); j++) { | ||||
prevheights[j] = view.AccessCoin(tx.vin[j].prevout).GetHeight(); | prevheights[j] = view.AccessCoin(tx.vin[j].prevout).GetHeight(); | ||||
} | } | ||||
if (!SequenceLocks(tx, nLockTimeFlags, &prevheights, *pindex)) { | if (!SequenceLocks(tx, nLockTimeFlags, prevheights, *pindex)) { | ||||
LogPrintf("ERROR: %s: contains a non-BIP68-final transaction\n", | LogPrintf("ERROR: %s: contains a non-BIP68-final transaction\n", | ||||
__func__); | __func__); | ||||
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, | return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, | ||||
"bad-txns-nonfinal"); | "bad-txns-nonfinal"); | ||||
} | } | ||||
// Don't cache results if we're actually connecting blocks (still | // Don't cache results if we're actually connecting blocks (still | ||||
// consult the cache, though). | // consult the cache, though). | ||||
▲ Show 20 Lines • Show All 4,021 Lines • Show Last 20 Lines |