When a transaction is being checked for validity, is there a particular order that the inputs are evaluated for script correctness?
This might be relevant when determining what consensus changes might be practical to design. For example, if we wanted to add incremental metadata for a given transaction during validation -- for example, "sum the nValues for inputs that are related ways x, y, z - but do it on the fly so we don't impair validation speed."
Whether or not inputs are validated in a certain order would help gauge the feasibility of a consensus change that relayed on those kinds of "lazy" data computation.
Right now in the source code, the CheckInputScripts()
function creates CScriptCheck
objects in order of vin
. Does this mean that input scripts are validated in order of vin-index?
// validation.cpp
for (unsigned int i = 0; i < tx.vin.size(); i++) {
[...]
// Verify signature
CScriptCheck check(txdata.m_spent_outputs[i], tx, i, flags, cacheSigStore, &txdata);
if (pvChecks) {
pvChecks->push_back(CScriptCheck());
If we got cross-input signature aggregation, would that change such an ordering?