Skip to content

Commit 2120c31

Browse files
TheBlueMattsdaftuar
authored andcommitted
[refactor] Update some comments in validation.cpp as we arent doing DoS there
1 parent 12dbdd7 commit 2120c31

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/validation.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,21 +1410,25 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
14101410
// Check whether the failure was caused by a
14111411
// non-mandatory script verification check, such as
14121412
// 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.
14161418
CScriptCheck check2(coin.out, tx, i,
14171419
flags & ~STANDARD_NOT_MANDATORY_VERIFY_FLAGS, cacheSigStore, &txdata);
14181420
if (check2())
14191421
return state.Invalid(ValidationInvalidReason::TX_NOT_STANDARD, false, REJECT_NONSTANDARD, strprintf("non-mandatory-script-verify-flag (%s)", ScriptErrorString(check.GetScriptError())));
14201422
}
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).
14281432
return state.Invalid(ValidationInvalidReason::CONSENSUS, false, REJECT_INVALID, strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(check.GetScriptError())));
14291433
}
14301434
}

0 commit comments

Comments
 (0)