Skip to content

Commit 7cbe5cd

Browse files
committed
Add -datacarrierfullcount option to control applying -datacarriersize to all datacarrying
1 parent 6da90ef commit 7cbe5cd

File tree

6 files changed

+7
-2
lines changed

6 files changed

+7
-2
lines changed

src/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ void SetupServerArgs(ArgsManager& argsman)
644644
argsman.AddArg("-bytespersigop", strprintf("Equivalent bytes per sigop in transactions for relay and mining (default: %u)", DEFAULT_BYTES_PER_SIGOP), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
645645
argsman.AddArg("-bytespersigopstrict", strprintf("Minimum bytes per sigop in transactions we relay and mine (default: %u)", DEFAULT_BYTES_PER_SIGOP_STRICT), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
646646
argsman.AddArg("-datacarrier", strprintf("Relay and mine data carrier transactions (default: %u)", DEFAULT_ACCEPT_DATACARRIER), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
647+
argsman.AddArg("-datacarrierfullcount", strprintf("Apply datacarriersize limit to all known datacarrier methods (default: %u)", DEFAULT_DATACARRIER_FULLCOUNT), ArgsManager::ALLOW_ANY | (DEFAULT_DATACARRIER_FULLCOUNT ? uint32_t{ArgsManager::DEBUG_ONLY} : 0), OptionsCategory::NODE_RELAY);
647648
argsman.AddArg("-datacarriersize",
648649
strprintf("Relay and mine transactions whose data-carrying raw scriptPubKey "
649650
"is of this size or less (default: %u)",

src/kernel/mempool_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct MemPoolOptions {
5858
* If nullopt, any size is nonstandard.
5959
*/
6060
std::optional<unsigned> max_datacarrier_bytes{DEFAULT_ACCEPT_DATACARRIER ? std::optional{MAX_OP_RETURN_RELAY} : std::nullopt};
61+
bool datacarrier_fullcount{DEFAULT_DATACARRIER_FULLCOUNT};
6162
bool permit_bare_pubkey{DEFAULT_PERMIT_BAREPUBKEY};
6263
bool permit_bare_multisig{DEFAULT_PERMIT_BAREMULTISIG};
6364
bool require_standard{true};

src/node/mempool_args.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& argsman, const CChainP
9090
} else {
9191
mempool_opts.max_datacarrier_bytes = std::nullopt;
9292
}
93+
mempool_opts.datacarrier_fullcount = argsman.GetBoolArg("-datacarrierfullcount", DEFAULT_DATACARRIER_FULLCOUNT);
9394

9495
mempool_opts.require_standard = !argsman.GetBoolArg("-acceptnonstdtxn", DEFAULT_ACCEPT_NON_STD_TXN);
9596
if (!chainparams.IsTestChain() && !mempool_opts.require_standard) {

src/policy/policy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ static const bool DEFAULT_ACCEPT_DATACARRIER = true;
7979
* +2 for the pushdata opcodes.
8080
*/
8181
static const unsigned int MAX_OP_RETURN_RELAY = 83;
82+
/** Default for -datacarrierfullcount */
83+
static constexpr bool DEFAULT_DATACARRIER_FULLCOUNT{false};
8284
/**
8385
* An extra transaction can be added to a package, as long as it only has one
8486
* ancestor and is no larger than this. Not really any reason to make this

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
967967
return state.Invalid(TxValidationResult::TX_INPUTS_NOT_STANDARD, reason);
968968
}
969969

970-
if ((!ignore_rejects.count("txn-datacarrier-exceeded")) && DatacarrierBytes(tx, m_view) > m_pool.m_max_datacarrier_bytes.value_or(0)) {
970+
if (m_pool.m_opts.datacarrier_fullcount && (!ignore_rejects.count("txn-datacarrier-exceeded")) && DatacarrierBytes(tx, m_view) > m_pool.m_opts.max_datacarrier_bytes.value_or(0)) {
971971
return state.Invalid(TxValidationResult::TX_INPUTS_NOT_STANDARD, "txn-datacarrier-exceeded");
972972
}
973973

test/functional/feature_taproot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ def skip_test_if_missing_module(self):
12851285
def set_test_params(self):
12861286
self.num_nodes = 1
12871287
self.setup_clean_chain = True
1288-
self.extra_args = [["-par=1"]]
1288+
self.extra_args = [["-par=1", "-datacarrierfullcount"]]
12891289

12901290
def block_submit(self, node, txs, msg, err_msg, cb_pubkey=None, fees=0, sigops_weight=0, witness=False, accept=False):
12911291

0 commit comments

Comments
 (0)