Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 1,221 Lines • ▼ Show 20 Lines | bool CheckInputs(const CTransaction &tx, CValidationState &state, | ||||
if (!fScriptChecks) { | if (!fScriptChecks) { | ||||
return true; | return true; | ||||
} | } | ||||
// First check if script executions have been cached with the same flags. | // First check if script executions have been cached with the same flags. | ||||
// Note that this assumes that the inputs provided are correct (ie that the | // Note that this assumes that the inputs provided are correct (ie that the | ||||
// transaction hash which is in tx's prevouts properly commits to the | // transaction hash which is in tx's prevouts properly commits to the | ||||
// scriptPubKey in the inputs view of that transaction). | // scriptPubKey in the inputs view of that transaction). | ||||
uint256 hashCacheEntry = GetScriptCacheKey(tx, flags); | ScriptCacheKey hashCacheEntry(tx, flags); | ||||
if (IsKeyInScriptCache(hashCacheEntry, !scriptCacheStore)) { | int nSigChecksDummy; | ||||
if (IsKeyInScriptCache(hashCacheEntry, !scriptCacheStore, | |||||
nSigChecksDummy)) { | |||||
return true; | return true; | ||||
} | } | ||||
for (size_t i = 0; i < tx.vin.size(); i++) { | for (size_t i = 0; i < tx.vin.size(); i++) { | ||||
const COutPoint &prevout = tx.vin[i].prevout; | const COutPoint &prevout = tx.vin[i].prevout; | ||||
const Coin &coin = inputs.AccessCoin(prevout); | const Coin &coin = inputs.AccessCoin(prevout); | ||||
assert(!coin.IsSpent()); | assert(!coin.IsSpent()); | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < tx.vin.size(); i++) { | ||||
strprintf("mandatory-script-verify-flag-failed (%s)", | strprintf("mandatory-script-verify-flag-failed (%s)", | ||||
ScriptErrorString(scriptError))); | ScriptErrorString(scriptError))); | ||||
} | } | ||||
} | } | ||||
if (scriptCacheStore && !pvChecks) { | if (scriptCacheStore && !pvChecks) { | ||||
// We executed all of the provided scripts, and were told to cache the | // We executed all of the provided scripts, and were told to cache the | ||||
// result. Do so now. | // result. Do so now. | ||||
AddKeyInScriptCache(hashCacheEntry); | AddKeyInScriptCache(hashCacheEntry, 0); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
namespace { | namespace { | ||||
bool UndoWriteToDisk(const CBlockUndo &blockundo, FlatFilePos &pos, | bool UndoWriteToDisk(const CBlockUndo &blockundo, FlatFilePos &pos, | ||||
▲ Show 20 Lines • Show All 4,411 Lines • Show Last 20 Lines |