mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
[Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck
This commit is contained in:
parent
a90e6d2bff
commit
e912118786
4 changed files with 10 additions and 17 deletions
|
|
@ -1202,7 +1202,7 @@ void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, int nHeight)
|
|||
bool CScriptCheck::operator()() {
|
||||
const CScript &scriptSig = ptxTo->vin[nIn].scriptSig;
|
||||
const CScriptWitness *witness = &ptxTo->vin[nIn].scriptWitness;
|
||||
return VerifyScript(scriptSig, scriptPubKey, witness, nFlags, CachingTransactionSignatureChecker(ptxTo, nIn, amount, cacheStore, *txdata), &error);
|
||||
return VerifyScript(scriptSig, out.scriptPubKey, witness, nFlags, CachingTransactionSignatureChecker(ptxTo, nIn, out.nValue, cacheStore, *txdata), &error);
|
||||
}
|
||||
|
||||
int GetSpendHeight(const CCoinsViewCache& inputs)
|
||||
|
|
@ -1284,11 +1284,9 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
|
|||
// a sanity check that our caching is not introducing consensus
|
||||
// failures through additional data in, eg, the coins being
|
||||
// spent being checked as a part of CScriptCheck.
|
||||
const CScript& scriptPubKey = coin.out.scriptPubKey;
|
||||
const CAmount amount = coin.out.nValue;
|
||||
|
||||
// Verify signature
|
||||
CScriptCheck check(scriptPubKey, amount, tx, i, flags, cacheSigStore, &txdata);
|
||||
CScriptCheck check(coin.out, tx, i, flags, cacheSigStore, &txdata);
|
||||
if (pvChecks) {
|
||||
pvChecks->push_back(CScriptCheck());
|
||||
check.swap(pvChecks->back());
|
||||
|
|
@ -1300,7 +1298,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
|
|||
// arguments; if so, don't trigger DoS protection to
|
||||
// avoid splitting the network between upgraded and
|
||||
// non-upgraded nodes.
|
||||
CScriptCheck check2(scriptPubKey, amount, tx, i,
|
||||
CScriptCheck check2(coin.out, tx, i,
|
||||
flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS, cacheSigStore, &txdata);
|
||||
if (check2())
|
||||
return state.Invalid(false, REJECT_NONSTANDARD, strprintf("non-mandatory-script-verify-flag (%s)", ScriptErrorString(check.GetScriptError())));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue