@@ -1410,21 +1410,25 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
1410
1410
// Check whether the failure was caused by a
1411
1411
// non-mandatory script verification check, such as
1412
1412
// non-standard DER encodings or non-null dummy
1413
- // arguments; if so, don't trigger DoS protection to
1414
- // avoid splitting the network between upgraded and
1415
- // non-upgraded nodes.
1413
+ // arguments; if so, ensure we return NOT_STANDARD
1414
+ // instead of CONSENSUS to avoid downstream users
1415
+ // splitting the network between upgraded and
1416
+ // non-upgraded nodes by banning CONSENSUS-failing
1417
+ // data providers.
1416
1418
CScriptCheck check2 (coin.out , tx, i,
1417
1419
flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS, cacheSigStore, &txdata);
1418
1420
if (check2 ())
1419
1421
return state.Invalid (ValidationInvalidReason::TX_NOT_STANDARD, false , REJECT_NONSTANDARD, strprintf (" non-mandatory-script-verify-flag (%s)" , ScriptErrorString (check.GetScriptError ())));
1420
1422
}
1421
- // Failures of other flags indicate a transaction that is
1422
- // invalid in new blocks, e.g. an invalid P2SH. We DoS ban
1423
- // such nodes as they are not following the protocol. That
1424
- // said during an upgrade careful thought should be taken
1425
- // as to the correct behavior - we may want to continue
1426
- // peering with non-upgraded nodes even after soft-fork
1427
- // super-majority signaling has occurred.
1423
+ // MANDATORY flag failures correspond to
1424
+ // ValidationInvalidReason::CONSENSUS. Because CONSENSUS
1425
+ // failures are the most serious case of validation
1426
+ // failures, we may need to consider using
1427
+ // RECENT_CONSENSUS_CHANGE for any script failure that
1428
+ // could be due to non-upgraded nodes which we may want to
1429
+ // support, to avoid splitting the network (but this
1430
+ // depends on the details of how net_processing handles
1431
+ // such errors).
1428
1432
return state.Invalid (ValidationInvalidReason::CONSENSUS, false , REJECT_INVALID, strprintf (" mandatory-script-verify-flag-failed (%s)" , ScriptErrorString (check.GetScriptError ())));
1429
1433
}
1430
1434
}
0 commit comments