mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
[validation] fix comments in CheckInputScripts()
This commit is contained in:
parent
6f6465cefc
commit
3bd8db80d8
1 changed files with 9 additions and 7 deletions
|
@ -406,12 +406,12 @@ static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, TxValidationS
|
||||||
for (const CTxIn& txin : tx.vin) {
|
for (const CTxIn& txin : tx.vin) {
|
||||||
const Coin& coin = view.AccessCoin(txin.prevout);
|
const Coin& coin = view.AccessCoin(txin.prevout);
|
||||||
|
|
||||||
// At this point we haven't actually checked if the coins are all
|
// AcceptToMemoryPoolWorker has already checked that the coins are
|
||||||
// available (or shouldn't assume we have, since CheckInputScripts does).
|
// available, so this shouldn't fail. If the inputs are not available
|
||||||
// So we just return failure if the inputs are not available here,
|
// here then return false.
|
||||||
// and then only have to check equivalence for available inputs.
|
|
||||||
if (coin.IsSpent()) return false;
|
if (coin.IsSpent()) return false;
|
||||||
|
|
||||||
|
// Check equivalence for available inputs.
|
||||||
const CTransactionRef& txFrom = pool.get(txin.prevout.hash);
|
const CTransactionRef& txFrom = pool.get(txin.prevout.hash);
|
||||||
if (txFrom) {
|
if (txFrom) {
|
||||||
assert(txFrom->GetHash() == txin.prevout.hash);
|
assert(txFrom->GetHash() == txin.prevout.hash);
|
||||||
|
@ -909,7 +909,7 @@ bool MemPoolAccept::PolicyScriptChecks(ATMPArgs& args, Workspace& ws, Precompute
|
||||||
|
|
||||||
constexpr unsigned int scriptVerifyFlags = STANDARD_SCRIPT_VERIFY_FLAGS;
|
constexpr unsigned int scriptVerifyFlags = STANDARD_SCRIPT_VERIFY_FLAGS;
|
||||||
|
|
||||||
// Check against previous transactions
|
// Check input scripts and signatures.
|
||||||
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
|
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
|
||||||
if (!CheckInputScripts(tx, state, m_view, scriptVerifyFlags, true, false, txdata)) {
|
if (!CheckInputScripts(tx, state, m_view, scriptVerifyFlags, true, false, txdata)) {
|
||||||
// SCRIPT_VERIFY_CLEANSTACK requires SCRIPT_VERIFY_WITNESS, so we
|
// SCRIPT_VERIFY_CLEANSTACK requires SCRIPT_VERIFY_WITNESS, so we
|
||||||
|
@ -1469,8 +1469,10 @@ void InitScriptExecutionCache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether all inputs of this transaction are valid (no double spends, scripts & sigs, amounts)
|
* Check whether all of this transaction's input scripts succeed.
|
||||||
* This does not modify the UTXO set.
|
*
|
||||||
|
* This involves ECDSA signature checks so can be computationally intensive. This function should
|
||||||
|
* only be called after the cheap sanity checks in CheckTxInputs passed.
|
||||||
*
|
*
|
||||||
* If pvChecks is not nullptr, script checks are pushed onto it instead of being performed inline. Any
|
* If pvChecks is not nullptr, script checks are pushed onto it instead of being performed inline. Any
|
||||||
* script checks which are not necessary (eg due to script execution cache hits) are, obviously,
|
* script checks which are not necessary (eg due to script execution cache hits) are, obviously,
|
||||||
|
|
Loading…
Add table
Reference in a new issue