[refactor] Update some comments in validation.cpp as we arent doing DoS there

This commit is contained in:
Matt Corallo 2018-04-17 10:46:30 -04:00 committed by Suhas Daftuar
parent 12dbdd7a41
commit 2120c31521

View file

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