Skip to content

Commit e1dc15d

Browse files
committed
config: default acceptnonstdtxn=0 on all chains
Previously, the default for acceptnonstdtxn defaulted to 0 on all chains except testnet. Change this to be consistent across all chains, and remove the parameter from chainparams entirely.
1 parent 8371914 commit e1dc15d

File tree

5 files changed

+4
-9
lines changed

5 files changed

+4
-9
lines changed

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)