Bitcoin Core #29843 · merged 2026-10-29
Allow non-standard scripts with -acceptnonstdtxn=1
On test networks, nodes can now relay and mine transactions that only break policy script rules, like spends using OP_SUCCESS or OP_NOPx. That makes it easier to try out proposed soft forks.
Author: ajtowns · Test networks only · github.com/bitcoin/bitcoin/pull/29843
Background
Two sets of script rules
The "upgrade hook" flags keep unassigned opcodes and versions out of the mempool, so a future soft fork can give them meaning without anyone having already used them.
What changed
An OP_SUCCESS spend now reaches the mempool
Before, the option skipped output and size checks like dust and OP_RETURN limits, but script checks still used the full standard flag set.
Now allowed on test networks
Spends a future soft fork might define
OP_SUCCESSx
Tapscript opcodes reserved for upgrades, like a re-enabled OP_CAT. Today they make a script succeed unconditionally.
OP_NOP1, OP_NOP4–10
Legacy no-ops kept for upgrades, the way CLTV and CSV were added. OP_NOP2 and OP_NOP3 are exempt because they're already CLTV and CSV.
Unknown versions
Unknown Taproot leaf versions, unknown witness program versions, and unknown tapscript public key types.
Hygiene rules too
High-S signatures, non-minimal pushes, unclean stacks and the other malleability checks are skipped as well.
Still rejected: anything that breaks a consensus flag, including rules from any soft fork deployment the chain has defined, even before it activates.
The change
Swap the flag set when standardness is off
// src/validation.cpp · MemPoolAccept::PolicyScriptChecks() - constexpr script_verify_flags scriptVerifyFlags = STANDARD_SCRIPT_VERIFY_FLAGS; + const script_verify_flags scriptVerifyFlags = (m_pool.m_opts.require_standard + ? STANDARD_SCRIPT_VERIFY_FLAGS + : m_active_chainstate.m_chainman.m_all_consensus_script_flags); // New: every consensus flag any deployment on this chain could turn on + ConsensusScriptVerifyFlags flags{SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_TAPROOT}; + flags |= add_pending_flag<SCRIPT_VERIFY_DERSIG>(params, Consensus::DEPLOYMENT_DERSIG); + flags |= add_pending_flag<SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY>(params, Consensus::DEPLOYMENT_CLTV); + …
- It uses all possible consensus flags, not just the active ones, so a tx can't sit in the mempool and become invalid when a pending soft fork activates.
- New compile-time checks (
static_assert,consteval) make sure standard flags stay a superset of consensus flags.
Why not mainnet?
Still refused on mainnet
$ bitcoind -acceptnonstdtxn=1 Error: acceptnonstdtxn is not currently supported for main chain
Non-mining nodes
Non-standard txs can sit in your mempool and conflict with standard ones, which can break apps and layer-2 protocols.
Mining nodes
A tx accepted before a soft fork activates could make your blocks invalid. ajtowns notes a restart reloads the mempool under the new rules.
The Knots objection
luke-jr: the option came from Knots, where it runs on mainnet and never enabled upgradable opcodes. He suggested making this =2.
Discussion
Questions for the room
- ajtowns' motivation: OP_CAT and SIGHASH_APO txs are standard on Bitcoin Inquisition but mainline Core couldn't accept them. Does this make Inquisition-style experiments on other test networks practical?
- Testnet5 enforces BIP54 from block 1. Should it ship with miners running this option?
- Should the upgrade hooks ever be split from the hygiene rules, e.g. allow OP_SUCCESS but keep LOW_S?
- Was changing an existing option's meaning right, or should it have been a new value like
=2?