diff options
author | Andrew Chow <github@achow101.com> | 2023-08-23 16:11:24 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-08-23 16:19:39 -0400 |
commit | 8ff90d9dcfee12090421675c9c421ee611e5ec8b (patch) | |
tree | 607d19191251c2159ac145f51b8cf253aefa3c83 /src/policy | |
parent | 33da5d0eb155993ab0d07c95704a0dd9e981c100 (diff) | |
parent | 1b09cc5959d4719ffad131b395f8185e9ab4b1a1 (diff) |
Merge bitcoin/bitcoin#26291: Update MANDATORY_SCRIPT_VERIFY_FLAGS
1b09cc5959d4719ffad131b395f8185e9ab4b1a1 Make post-p2sh consensus rules mandatory for tx relay (Anthony Towns)
69c31bc748104407c596e84bcef893dc968fd758 doc, policy: Clarify comment on STANDARD_SCRIPT_VERIFY_FLAGS (Anthony Towns)
Pull request description:
The `MANDATORY_SCRIPT_VERIFY_FLAGS` constant was introduced in #3843 to distinguish between block consensus rules and relay standardness rules. However it was not actually used in the consensus code path: instead it only differentiates between the failure being reported as `TX_CONSENSUS` and `mandatory-script-verify-flag-failed` vs `TX_NOT_STANDARD` and `non-mandatory-script-verify-flag`.
This updates the list of mandatory flags to include the post-p2sh soft forks that are enforced as consensus rules via `GetBlockScriptFlags()`. The effect of this change is that validation.cpp will report `TX_CONSENSUS` failures for txs that fail dersig/csv/cltv/nulldummy/witness/taproot checks, instead of `TX_NOT_STANDARD`, which in turn adds `Misbehaving(100)` via `MaybePunishNodeForTx` in `net_processing`.
ACKs for top commit:
Sjors:
Code review ACK 1b09cc5959d4719ffad131b395f8185e9ab4b1a1
darosior:
ACK 1b09cc5959d4719ffad131b395f8185e9ab4b1a1
achow101:
ACK 1b09cc5959d4719ffad131b395f8185e9ab4b1a1
theStack:
Concept and code-review ACK 1b09cc5959d4719ffad131b395f8185e9ab4b1a1
Tree-SHA512: d3e5868e8cece478f2e934956ba0c231d8bb9c2daefd0df1f817774e292049902cfc1d0cd76dbd2e7722627a93eab2d7046ff678199aac70a2b01642e69349f1
Diffstat (limited to 'src/policy')
-rw-r--r-- | src/policy/policy.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/policy/policy.h b/src/policy/policy.h index 687d1881cb..d1c8148800 100644 --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -86,30 +86,31 @@ static constexpr unsigned int EXTRA_DESCENDANT_TX_SIZE_LIMIT{10000}; * Note that this does not affect consensus validity; see GetBlockScriptFlags() * for that. */ -static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH; +static constexpr unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS{SCRIPT_VERIFY_P2SH | + SCRIPT_VERIFY_DERSIG | + SCRIPT_VERIFY_NULLDUMMY | + SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY | + SCRIPT_VERIFY_CHECKSEQUENCEVERIFY | + SCRIPT_VERIFY_WITNESS | + SCRIPT_VERIFY_TAPROOT}; /** * Standard script verification flags that standard transactions will comply * with. However we do not ban/disconnect nodes that forward txs violating - * these rules, for better forwards and backwards compatability. + * the additional (non-mandatory) rules here, to improve forwards and + * backwards compatability. */ static constexpr unsigned int STANDARD_SCRIPT_VERIFY_FLAGS{MANDATORY_SCRIPT_VERIFY_FLAGS | - SCRIPT_VERIFY_DERSIG | SCRIPT_VERIFY_STRICTENC | SCRIPT_VERIFY_MINIMALDATA | - SCRIPT_VERIFY_NULLDUMMY | SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS | SCRIPT_VERIFY_CLEANSTACK | SCRIPT_VERIFY_MINIMALIF | SCRIPT_VERIFY_NULLFAIL | - SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY | - SCRIPT_VERIFY_CHECKSEQUENCEVERIFY | SCRIPT_VERIFY_LOW_S | - SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM | SCRIPT_VERIFY_WITNESS_PUBKEYTYPE | SCRIPT_VERIFY_CONST_SCRIPTCODE | - SCRIPT_VERIFY_TAPROOT | SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION | SCRIPT_VERIFY_DISCOURAGE_OP_SUCCESS | SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_PUBKEYTYPE}; |