Skip to content

Commit 5175ae4

Browse files
committed
Merge bitcoin/bitcoin#28354: test: default acceptnonstdtxn=0 on all chains
13eb8aa doc: Release notes for testnet defaulting to -acceptnonstdtxn=0 (Anthony Towns) e1dc15d config: default acceptnonstdtxn=0 on all chains (Anthony Towns) Pull request description: Changes `-acceptnonstxtxn` to default to 0 on testnet, matching the other chains. Allowing non-standard txs on testnet by default contributed to the difficulties RSK described in #26348: "We see that there are two script paths and, to reduce the script size, a single CHECKMULTISIG is used for the two paths, separating the signer count from the CHECKMULTISIG opcode. This script worked on testnet, because it lacks the standard checks performed in Mainnet." ACKs for top commit: MarcoFalke: lgtm ACK 13eb8aa sipa: utACK 13eb8aa instagibbs: utACK bitcoin/bitcoin@13eb8aa theStack: Code-review ACK 13eb8aa Tree-SHA512: eff7a3f9fc9b94003a730beb96e6f3399bc8b8e93fde4b15f20a11eda61d9a3e076f4423989f98b794b32681abecbc3756a54cd0d37b136e2fb2ffbb47ee7774
2 parents 1c1a02b + 13eb8aa commit 5175ae4

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

doc/release-notes-28354.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Tests
2+
-----
3+
4+
- Non-standard transactions are now disabled by default on testnet
5+
for relay and mempool acceptance. The previous behaviour can be
6+
re-enabled by setting `-acceptnonstdtxn=1`. (#28354)

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ void SetupServerArgs(ArgsManager& argsman)
585585

586586
SetupChainParamsBaseOptions(argsman);
587587

588-
argsman.AddArg("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (%sdefault: %u)", "testnet/regtest only; ", !testnetChainParams->RequireStandard()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY);
588+
argsman.AddArg("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (test networks only; default: %u)", DEFAULT_ACCEPT_NON_STD_TXN), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY);
589589
argsman.AddArg("-incrementalrelayfee=<amt>", strprintf("Fee rate (in %s/kvB) used to define cost of relay, used for mempool limiting and replacement policy. (default: %s)", CURRENCY_UNIT, FormatMoney(DEFAULT_INCREMENTAL_RELAY_FEE)), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY);
590590
argsman.AddArg("-dustrelayfee=<amt>", strprintf("Fee rate (in %s/kvB) used to define dust, the value of an output such that it will cost more than its value in fees at this fee rate to spend it. (default: %s)", CURRENCY_UNIT, FormatMoney(DUST_RELAY_TX_FEE)), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY);
591591
argsman.AddArg("-acceptstalefeeestimates", strprintf("Read fee estimates even if they are stale (%sdefault: %u) fee estimates are considered stale if they are %s hours old", "regtest only; ", DEFAULT_ACCEPT_STALE_FEE_ESTIMATES, Ticks<std::chrono::hours>(MAX_FILE_AGE)), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);

src/kernel/chainparams.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ class CMainParams : public CChainParams {
151151
vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_main), std::end(chainparams_seed_main));
152152

153153
fDefaultConsistencyChecks = false;
154-
fRequireStandard = true;
155154
m_is_test_chain = false;
156155
m_is_mockable_chain = false;
157156

@@ -259,7 +258,6 @@ class CTestNetParams : public CChainParams {
259258
vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_test), std::end(chainparams_seed_test));
260259

261260
fDefaultConsistencyChecks = false;
262-
fRequireStandard = false;
263261
m_is_test_chain = true;
264262
m_is_mockable_chain = false;
265263

@@ -382,7 +380,6 @@ class SigNetParams : public CChainParams {
382380
bech32_hrp = "tb";
383381

384382
fDefaultConsistencyChecks = false;
385-
fRequireStandard = true;
386383
m_is_test_chain = true;
387384
m_is_mockable_chain = false;
388385
}
@@ -474,7 +471,6 @@ class CRegTestParams : public CChainParams
474471
vSeeds.emplace_back("dummySeed.invalid.");
475472

476473
fDefaultConsistencyChecks = true;
477-
fRequireStandard = true;
478474
m_is_test_chain = true;
479475
m_is_mockable_chain = true;
480476

src/kernel/chainparams.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ class CChainParams
102102
const CBlock& GenesisBlock() const { return genesis; }
103103
/** Default value for -checkmempool and -checkblockindex argument */
104104
bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
105-
/** Policy: Filter transactions that do not match well-defined patterns */
106-
bool RequireStandard() const { return fRequireStandard; }
107105
/** If this chain is exclusively used for testing */
108106
bool IsTestChain() const { return m_is_test_chain; }
109107
/** If this chain allows time to be mocked */
@@ -179,7 +177,6 @@ class CChainParams
179177
CBlock genesis;
180178
std::vector<uint8_t> vFixedSeeds;
181179
bool fDefaultConsistencyChecks;
182-
bool fRequireStandard;
183180
bool m_is_test_chain;
184181
bool m_is_mockable_chain;
185182
CCheckpointData checkpointData;

src/kernel/mempool_options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ static constexpr unsigned int DEFAULT_BLOCKSONLY_MAX_MEMPOOL_SIZE_MB{5};
2323
static constexpr unsigned int DEFAULT_MEMPOOL_EXPIRY_HOURS{336};
2424
/** Default for -mempoolfullrbf, if the transaction replaceability signaling is ignored */
2525
static constexpr bool DEFAULT_MEMPOOL_FULL_RBF{false};
26+
/** Default for -acceptnonstdtxn */
27+
static constexpr bool DEFAULT_ACCEPT_NON_STD_TXN{false};
2628

2729
namespace kernel {
2830
/**

src/node/mempool_args.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& argsman, const CChainP
8686
mempool_opts.max_datacarrier_bytes = std::nullopt;
8787
}
8888

89-
mempool_opts.require_standard = !argsman.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
89+
mempool_opts.require_standard = !argsman.GetBoolArg("-acceptnonstdtxn", DEFAULT_ACCEPT_NON_STD_TXN);
9090
if (!chainparams.IsTestChain() && !mempool_opts.require_standard) {
9191
return util::Error{strprintf(Untranslated("acceptnonstdtxn is not currently supported for %s chain"), chainparams.GetChainTypeString())};
9292
}

0 commit comments

Comments
 (0)