v30.3-roots.1 · Commit 3: [PATCH 03/68] feat(policy): preserve Roots relay and network controls on Core 30.3
src/init.cpp
Before: src/init.cpp · After: src/init.cpp
File metadata
index def3211ef412c9f1769739cc10a43dda3becb286..b98bf0f6a8a0e7aa90c34253a3ad44f12e2bcf81 100644
Download original patch · Release notes
Diff rows 1–184 of 184. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/init.cpp
CHANGED
|
@@ -492,6 +492,10 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc)
|
|
| 492 |
argsman.AddArg("-blocknotify=<cmd>", "Execute command when the best block changes (%s in cmd is replaced by block hash)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
| 493 |
#endif
|
| 494 |
argsman.AddArg("-blockreconstructionextratxn=<n>", strprintf("Extra transactions to keep in memory for compact block reconstructions (default: %u)", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 495 |
argsman.AddArg("-blocksonly", strprintf("Whether to reject transactions from network peers. Disables automatic broadcast and rebroadcast of transactions, unless the source peer has the 'forcerelay' permission. RPC transactions are not affected. (default: %u)", DEFAULT_BLOCKSONLY), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
| 496 |
argsman.AddArg("-coinstatsindex", strprintf("Maintain coinstats index used by the gettxoutsetinfo RPC (default: %u)", DEFAULT_COINSTATSINDEX), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
| 497 |
argsman.AddArg("-conf=<file>", strprintf("Specify path to read-only configuration file. Relative paths will be prefixed by datadir location (only useable from command line, not configuration file) (default: %s)", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
|
@@ -558,8 +562,10 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc)
|
|
| 558 |
argsman.AddArg("-i2pacceptincoming", strprintf("Whether to accept inbound I2P connections (default: %i). Ignored if -i2psam is not set. Listening for inbound I2P connections is done through the SAM proxy, not by binding to a local address and port.", DEFAULT_I2P_ACCEPT_INCOMING), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
| 559 |
argsman.AddArg("-onlynet=<net>", "Make automatic outbound connections only to network <net> (" + Join(GetNetworkNames(), ", ") + "). Inbound and manual connections are not affected by this option. It can be specified multiple times to allow multiple networks.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
| 560 |
argsman.AddArg("-v2transport", strprintf("Support v2 transport (default: %u)", DEFAULT_V2_TRANSPORT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
| 561 |
-
argsman.AddArg("-peerbloomfilters", strprintf("Support filtering of blocks and transaction with bloom filters (default: %u)", DEFAULT_PEERBLOOMFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
|
|
|
| 562 |
argsman.AddArg("-peerblockfilters", strprintf("Serve compact block filters to peers per BIP 157 (default: %u)", DEFAULT_PEERBLOCKFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
|
|
|
| 563 |
argsman.AddArg("-txreconciliation", strprintf("Enable transaction reconciliations per BIP 330 (default: %d)", DEFAULT_TXRECONCILIATION_ENABLE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION);
|
| 564 |
argsman.AddArg("-port=<port>", strprintf("Listen for connections on <port> (default: %u, testnet3: %u, testnet4: %u, signet: %u, regtest: %u). Not relevant for I2P (see doc/i2p.md). If set to a value x, the default onion listening port will be set to x+1.", defaultChainParams->GetDefaultPort(), testnetChainParams->GetDefaultPort(), testnet4ChainParams->GetDefaultPort(), signetChainParams->GetDefaultPort(), regtestChainParams->GetDefaultPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
|
| 565 |
const std::string proxy_doc_for_value =
|
|
@@ -658,23 +664,38 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc)
|
|
| 658 |
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);
|
| 659 |
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);
|
| 660 |
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);
|
|
|
|
| 661 |
argsman.AddArg("-datacarrier", strprintf("Relay and mine data carrier transactions (default: %u)", DEFAULT_ACCEPT_DATACARRIER), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
|
|
|
| 662 |
argsman.AddArg("-datacarriersize",
|
| 663 |
strprintf("Relay and mine transactions whose data-carrying raw scriptPubKeys in aggregate "
|
| 664 |
"are of this size or less, allowing multiple outputs (default: %u)",
|
| 665 |
MAX_OP_RETURN_RELAY),
|
| 666 |
ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 667 |
argsman.AddArg("-permitbaremultisig", strprintf("Relay transactions creating non-P2SH multisig outputs (default: %u)", DEFAULT_PERMIT_BAREMULTISIG), ArgsManager::ALLOW_ANY,
|
| 668 |
OptionsCategory::NODE_RELAY);
|
|
|
|
| 669 |
argsman.AddArg("-minrelaytxfee=<amt>", strprintf("Fees (in %s/kvB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)",
|
| 670 |
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 671 |
argsman.AddArg("-whitelistforcerelay", strprintf("Add 'forcerelay' permission to whitelisted peers with default permissions. This will relay transactions even if the transactions were already in the mempool. (default: %d)", DEFAULT_WHITELISTFORCERELAY), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 672 |
argsman.AddArg("-whitelistrelay", strprintf("Add 'relay' permission to whitelisted peers with default permissions. This will accept relayed transactions even when not relaying transactions (default: %d)", DEFAULT_WHITELISTRELAY), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 673 |
|
| 674 |
|
| 675 |
-
argsman.AddArg("-blockmaxweight=<n>", strprintf("Set maximum BIP141 block weight (default: %d)", DEFAULT_BLOCK_MAX_WEIGHT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::BLOCK_CREATION);
|
|
|
|
| 676 |
argsman.AddArg("-blockreservedweight=<n>", strprintf("Reserve space for the fixed-size block header plus the largest coinbase transaction the mining software may add to the block. (default: %d).", DEFAULT_BLOCK_RESERVED_WEIGHT), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
| 677 |
argsman.AddArg("-blockmintxfee=<amt>", strprintf("Set lowest fee rate (in %s/kvB) for transactions to be included in block creation. (default: %s)", CURRENCY_UNIT, FormatMoney(DEFAULT_BLOCK_MIN_TX_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
|
|
|
| 678 |
argsman.AddArg("-blockversion=<n>", "Override block version to test forking scenarios", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::BLOCK_CREATION);
|
| 679 |
|
| 680 |
argsman.AddArg("-rest", strprintf("Accept public REST requests (default: %u)", DEFAULT_REST_ENABLE), ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
|
|
@@ -961,6 +982,8 @@ bool AppInitParameterInteraction(const ArgsManager& args)
|
|
| 961 |
// Signal NODE_P2P_V2 if BIP324 v2 transport is enabled.
|
| 962 |
if (args.GetBoolArg("-v2transport", DEFAULT_V2_TRANSPORT)) {
|
| 963 |
g_local_services = ServiceFlags(g_local_services | NODE_P2P_V2);
|
|
|
|
|
|
|
| 964 |
}
|
| 965 |
|
| 966 |
// Signal NODE_COMPACT_FILTERS if peerblockfilters and basic filters index are both enabled.
|
|
@@ -1051,6 +1074,13 @@ bool AppInitParameterInteraction(const ArgsManager& args)
|
|
| 1051 |
}
|
| 1052 |
}
|
| 1053 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1054 |
{
|
| 1055 |
const auto block_reserved_weight = args.GetIntArg("-blockreservedweight", DEFAULT_BLOCK_RESERVED_WEIGHT);
|
| 1056 |
if (block_reserved_weight > MAX_BLOCK_WEIGHT) {
|
|
@@ -1061,7 +1091,12 @@ bool AppInitParameterInteraction(const ArgsManager& args)
|
|
| 1061 |
}
|
| 1062 |
}
|
| 1063 |
|
|
|
|
| 1064 |
nBytesPerSigOp = args.GetIntArg("-bytespersigop", nBytesPerSigOp);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1065 |
|
| 1066 |
if (!g_wallet_init_interface.ParameterInteraction()) return false;
|
| 1067 |
|
|
@@ -1193,6 +1228,10 @@ bool CheckHostPortOptions(const ArgsManager& args) {
|
|
| 1193 |
}
|
| 1194 |
}
|
| 1195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1196 |
for ([[maybe_unused]] const auto& [param_name, unix, suffix_allowed] : std::vector<std::tuple<std::string, bool, bool>>{
|
| 1197 |
// arg name UNIX socket support =suffix allowed
|
| 1198 |
{"-i2psam", false, false},
|
|
@@ -2002,6 +2041,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|
| 2002 |
connOptions.m_peer_connect_timeout = peer_connect_timeout;
|
| 2003 |
connOptions.whitelist_forcerelay = args.GetBoolArg("-whitelistforcerelay", DEFAULT_WHITELISTFORCERELAY);
|
| 2004 |
connOptions.whitelist_relay = args.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY);
|
|
|
|
| 2005 |
|
| 2006 |
// Port to bind to if `-bind=addr` is provided without a `:port` suffix.
|
| 2007 |
const uint16_t default_bind_port =
|
|
@@ -2043,10 +2083,12 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|
| 2043 |
return InitError(ResolveErrMsg("bind", bind_arg));
|
| 2044 |
}
|
| 2045 |
|
|
|
|
| 2046 |
for (const std::string& strBind : args.GetArgs("-whitebind")) {
|
| 2047 |
NetWhitebindPermissions whitebind;
|
| 2048 |
bilingual_str error;
|
| 2049 |
if (!NetWhitebindPermissions::TryParse(strBind, whitebind, error)) return InitError(error);
|
|
|
|
| 2050 |
connOptions.vWhiteBinds.push_back(whitebind);
|
| 2051 |
}
|
| 2052 |
|
|
@@ -2063,17 +2105,31 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|
| 2063 |
}
|
| 2064 |
}
|
| 2065 |
|
|
|
|
|
|
|
| 2066 |
CService onion_service_target;
|
| 2067 |
if (!connOptions.onion_binds.empty()) {
|
| 2068 |
onion_service_target = connOptions.onion_binds.front();
|
| 2069 |
} else if (!connOptions.vBinds.empty()) {
|
| 2070 |
onion_service_target = connOptions.vBinds.front();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2071 |
} else {
|
| 2072 |
onion_service_target = DefaultOnionServiceTarget(default_bind_port_onion);
|
| 2073 |
connOptions.onion_binds.push_back(onion_service_target);
|
| 2074 |
}
|
| 2075 |
|
| 2076 |
-
if (args.GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION)) {
|
| 2077 |
if (connOptions.onion_binds.size() > 1) {
|
| 2078 |
InitWarning(strprintf(_("More than one onion bind address is provided. Using %s "
|
| 2079 |
"for the automatically created Tor onion service."),
|
|
@@ -2088,11 +2144,18 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|
| 2088 |
Discover();
|
| 2089 |
}
|
| 2090 |
|
| 2091 |
-
for (const auto& net : args.GetArgs("-whitelist")) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2092 |
NetWhitelistPermissions subnet;
|
| 2093 |
ConnectionDirection connection_direction;
|
| 2094 |
bilingual_str error;
|
| 2095 |
if (!NetWhitelistPermissions::TryParse(net, subnet, connection_direction, error)) return InitError(error);
|
|
|
|
| 2096 |
if (connection_direction & ConnectionDirection::In) {
|
| 2097 |
connOptions.vWhitelistedRangeIncoming.push_back(subnet);
|
| 2098 |
}
|
|
@@ -2101,6 +2164,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|
| 2101 |
}
|
| 2102 |
}
|
| 2103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2104 |
connOptions.vSeedNodes = args.GetArgs("-seednode");
|
| 2105 |
|
| 2106 |
const auto connect = args.GetArgs("-connect");
|
|
|
|
| 492 |
argsman.AddArg("-blocknotify=<cmd>", "Execute command when the best block changes (%s in cmd is replaced by block hash)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
| 493 |
#endif
|
| 494 |
argsman.AddArg("-blockreconstructionextratxn=<n>", strprintf("Extra transactions to keep in memory for compact block reconstructions (default: %u)", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
| 495 |
+
argsman.AddArg("-blockreconstructionextratxnsize=<n>",
|
| 496 |
+
strprintf("Upper limit of memory usage (in megabytes) for keeping extra transactions in memory for compact block reconstructions (default: %s)",
|
| 497 |
+
DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN_SIZE / 1000000),
|
| 498 |
+
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
| 499 |
argsman.AddArg("-blocksonly", strprintf("Whether to reject transactions from network peers. Disables automatic broadcast and rebroadcast of transactions, unless the source peer has the 'forcerelay' permission. RPC transactions are not affected. (default: %u)", DEFAULT_BLOCKSONLY), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
| 500 |
argsman.AddArg("-coinstatsindex", strprintf("Maintain coinstats index used by the gettxoutsetinfo RPC (default: %u)", DEFAULT_COINSTATSINDEX), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
| 501 |
argsman.AddArg("-conf=<file>", strprintf("Specify path to read-only configuration file. Relative paths will be prefixed by datadir location (only useable from command line, not configuration file) (default: %s)", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
|
|
|
| 562 |
argsman.AddArg("-i2pacceptincoming", strprintf("Whether to accept inbound I2P connections (default: %i). Ignored if -i2psam is not set. Listening for inbound I2P connections is done through the SAM proxy, not by binding to a local address and port.", DEFAULT_I2P_ACCEPT_INCOMING), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
| 563 |
argsman.AddArg("-onlynet=<net>", "Make automatic outbound connections only to network <net> (" + Join(GetNetworkNames(), ", ") + "). Inbound and manual connections are not affected by this option. It can be specified multiple times to allow multiple networks.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
| 564 |
argsman.AddArg("-v2transport", strprintf("Support v2 transport (default: %u)", DEFAULT_V2_TRANSPORT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
| 565 |
+
argsman.AddArg("-v2onlyclearnet", strprintf("Disallow outbound v1 connections on IPV4/IPV6 (default: %u). Enable this option only if you really need it. Use -listen=0 to disable inbound connections since they can be unencrypted.", false), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION);
|
| 566 |
+
argsman.AddArg("-peerbloomfilters", strprintf("Support filtering of blocks and transactions with bloom filters (default: %s)", DEFAULT_PEERBLOOMFILTERS ? "1" : "localhost only"), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
| 567 |
argsman.AddArg("-peerblockfilters", strprintf("Serve compact block filters to peers per BIP 157 (default: %u)", DEFAULT_PEERBLOCKFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
| 568 |
+
argsman.AddArg("-feefilter", strprintf("Tell other nodes to filter invs to us by our mempool min fee (default: %u)", DEFAULT_FEEFILTER), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION);
|
| 569 |
argsman.AddArg("-txreconciliation", strprintf("Enable transaction reconciliations per BIP 330 (default: %d)", DEFAULT_TXRECONCILIATION_ENABLE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION);
|
| 570 |
argsman.AddArg("-port=<port>", strprintf("Listen for connections on <port> (default: %u, testnet3: %u, testnet4: %u, signet: %u, regtest: %u). Not relevant for I2P (see doc/i2p.md). If set to a value x, the default onion listening port will be set to x+1.", defaultChainParams->GetDefaultPort(), testnetChainParams->GetDefaultPort(), testnet4ChainParams->GetDefaultPort(), signetChainParams->GetDefaultPort(), regtestChainParams->GetDefaultPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
|
| 571 |
const std::string proxy_doc_for_value =
|
|
|
|
| 664 |
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);
|
| 665 |
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);
|
| 666 |
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);
|
| 667 |
+
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);
|
| 668 |
argsman.AddArg("-datacarrier", strprintf("Relay and mine data carrier transactions (default: %u)", DEFAULT_ACCEPT_DATACARRIER), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 669 |
+
argsman.AddArg("-datacarriercost", strprintf("Treat data carrier bytes as at least N vbytes each (default: %s)", DEFAULT_WEIGHT_PER_DATA_BYTE / 4.0), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 670 |
argsman.AddArg("-datacarriersize",
|
| 671 |
strprintf("Relay and mine transactions whose data-carrying raw scriptPubKeys in aggregate "
|
| 672 |
"are of this size or less, allowing multiple outputs (default: %u)",
|
| 673 |
MAX_OP_RETURN_RELAY),
|
| 674 |
ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 675 |
+
argsman.AddArg("-permitbaredatacarrier", strprintf("Relay data carrier outputs without OP_RETURN (default: %u)", DEFAULT_PERMITBAREDATACARRIER), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 676 |
+
argsman.AddArg("-acceptnonstddatacarrier", strprintf("Relay nonstandard data carrier outputs (default: %u)", DEFAULT_ACCEPT_NON_STD_DATACARRIER), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 677 |
+
argsman.AddArg("-permitephemeral", "Permit ephemeral policy exceptions: send, dust, and anchor", ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 678 |
+
argsman.AddArg("-subdustfeepenalty", strprintf("Apply the sub-dust fee penalty to relay policy (default: %u)", DEFAULT_SUBDUSTFEEPENALTY), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 679 |
+
argsman.AddArg("-maxscriptsize=<n>", strprintf("Maximum size of scripts (including the witness stack) we relay and mine (default: %s)", DEFAULT_SCRIPT_SIZE_POLICY_LIMIT), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 680 |
+
argsman.AddArg("-maxtxlegacysigops", strprintf("Maximum legacy sigops in transactions we relay and mine (default: %s)", MAX_TX_LEGACY_SIGOPS), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 681 |
+
argsman.AddArg("-mempoolreplacement", "Set RBF policy: 0 disables, fee,optin honors signaling, and fee,-optin enables full RBF (default: fee,-optin)", ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 682 |
+
argsman.AddArg("-mempooltruc", "Set TRUC policy: reject, accept, or enforce (default: enforce)", ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 683 |
+
argsman.AddArg("-minrelaycoinblocks=<n>", strprintf("Minimum coin blocks a transaction must spend to be relayed (default: %s)", DEFAULT_MINRELAYCOINBLOCKS), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 684 |
+
argsman.AddArg("-minrelaymaturity=<n>", strprintf("Minimum input maturity before relay (default: %s)", DEFAULT_MINRELAYMATURITY), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 685 |
argsman.AddArg("-permitbaremultisig", strprintf("Relay transactions creating non-P2SH multisig outputs (default: %u)", DEFAULT_PERMIT_BAREMULTISIG), ArgsManager::ALLOW_ANY,
|
| 686 |
OptionsCategory::NODE_RELAY);
|
| 687 |
+
argsman.AddArg("-spkreuse=<policy>", "Set script reuse policy: allow or conflict (default: allow)", ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 688 |
argsman.AddArg("-minrelaytxfee=<amt>", strprintf("Fees (in %s/kvB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)",
|
| 689 |
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 690 |
argsman.AddArg("-whitelistforcerelay", strprintf("Add 'forcerelay' permission to whitelisted peers with default permissions. This will relay transactions even if the transactions were already in the mempool. (default: %d)", DEFAULT_WHITELISTFORCERELAY), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 691 |
argsman.AddArg("-whitelistrelay", strprintf("Add 'relay' permission to whitelisted peers with default permissions. This will accept relayed transactions even when not relaying transactions (default: %d)", DEFAULT_WHITELISTRELAY), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
|
| 692 |
|
| 693 |
|
| 694 |
+
argsman.AddArg("-blockmaxsize=<n>", strprintf("Set maximum block size in bytes (default: %d)", DEFAULT_BLOCK_MAX_SIZE), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
| 695 |
+
argsman.AddArg("-blockmaxweight=<n>", strprintf("Set maximum BIP141 block weight (default: %d)", DEFAULT_BLOCK_MAX_WEIGHT), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
| 696 |
argsman.AddArg("-blockreservedweight=<n>", strprintf("Reserve space for the fixed-size block header plus the largest coinbase transaction the mining software may add to the block. (default: %d).", DEFAULT_BLOCK_RESERVED_WEIGHT), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
| 697 |
argsman.AddArg("-blockmintxfee=<amt>", strprintf("Set lowest fee rate (in %s/kvB) for transactions to be included in block creation. (default: %s)", CURRENCY_UNIT, FormatMoney(DEFAULT_BLOCK_MIN_TX_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
| 698 |
+
argsman.AddArg("-blockprioritysize=<n>", strprintf("Set maximum size of high-priority/low-fee transactions in bytes (default: %d)", DEFAULT_BLOCK_PRIORITY_SIZE), ArgsManager::ALLOW_ANY, OptionsCategory::BLOCK_CREATION);
|
| 699 |
argsman.AddArg("-blockversion=<n>", "Override block version to test forking scenarios", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::BLOCK_CREATION);
|
| 700 |
|
| 701 |
argsman.AddArg("-rest", strprintf("Accept public REST requests (default: %u)", DEFAULT_REST_ENABLE), ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
|
|
|
|
| 982 |
// Signal NODE_P2P_V2 if BIP324 v2 transport is enabled.
|
| 983 |
if (args.GetBoolArg("-v2transport", DEFAULT_V2_TRANSPORT)) {
|
| 984 |
g_local_services = ServiceFlags(g_local_services | NODE_P2P_V2);
|
| 985 |
+
} else if (args.GetBoolArg("-v2onlyclearnet", false)) {
|
| 986 |
+
return InitError(_("Cannot set -v2onlyclearnet to true when v2transport is disabled."));
|
| 987 |
}
|
| 988 |
|
| 989 |
// Signal NODE_COMPACT_FILTERS if peerblockfilters and basic filters index are both enabled.
|
|
|
|
| 1074 |
}
|
| 1075 |
}
|
| 1076 |
|
| 1077 |
+
if (args.IsArgSet("-blockmaxsize")) {
|
| 1078 |
+
const auto max_block_size = args.GetIntArg("-blockmaxsize", DEFAULT_BLOCK_MAX_SIZE);
|
| 1079 |
+
if (max_block_size > MAX_BLOCK_SERIALIZED_SIZE) {
|
| 1080 |
+
return InitError(strprintf(_("Specified -blockmaxsize (%d) exceeds consensus maximum block size (%d)"), max_block_size, MAX_BLOCK_SERIALIZED_SIZE));
|
| 1081 |
+
}
|
| 1082 |
+
}
|
| 1083 |
+
|
| 1084 |
{
|
| 1085 |
const auto block_reserved_weight = args.GetIntArg("-blockreservedweight", DEFAULT_BLOCK_RESERVED_WEIGHT);
|
| 1086 |
if (block_reserved_weight > MAX_BLOCK_WEIGHT) {
|
|
|
|
| 1091 |
}
|
| 1092 |
}
|
| 1093 |
|
| 1094 |
+
g_script_size_policy_limit = args.GetIntArg("-maxscriptsize", g_script_size_policy_limit);
|
| 1095 |
nBytesPerSigOp = args.GetIntArg("-bytespersigop", nBytesPerSigOp);
|
| 1096 |
+
nBytesPerSigOpStrict = args.GetIntArg("-bytespersigopstrict", nBytesPerSigOpStrict);
|
| 1097 |
+
|
| 1098 |
+
const std::string spk_reuse = args.GetArg("-spkreuse", DEFAULT_SPKREUSE);
|
| 1099 |
+
SpkReuseMode = (spk_reuse == "allow" || args.GetBoolArg("-spkreuse", false)) ? SRM_ALLOW : SRM_REJECT;
|
| 1100 |
|
| 1101 |
if (!g_wallet_init_interface.ParameterInteraction()) return false;
|
| 1102 |
|
|
|
|
| 1228 |
}
|
| 1229 |
}
|
| 1230 |
|
| 1231 |
+
if (auto parsed = args.GetFixedPointArg("-datacarriercost", 2)) {
|
| 1232 |
+
g_weight_per_data_byte = ((*parsed * WITNESS_SCALE_FACTOR) + 99) / 100;
|
| 1233 |
+
}
|
| 1234 |
+
|
| 1235 |
for ([[maybe_unused]] const auto& [param_name, unix, suffix_allowed] : std::vector<std::tuple<std::string, bool, bool>>{
|
| 1236 |
// arg name UNIX socket support =suffix allowed
|
| 1237 |
{"-i2psam", false, false},
|
|
|
|
| 2041 |
connOptions.m_peer_connect_timeout = peer_connect_timeout;
|
| 2042 |
connOptions.whitelist_forcerelay = args.GetBoolArg("-whitelistforcerelay", DEFAULT_WHITELISTFORCERELAY);
|
| 2043 |
connOptions.whitelist_relay = args.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY);
|
| 2044 |
+
connOptions.disable_v1conn_clearnet = args.GetBoolArg("-v2onlyclearnet", false);
|
| 2045 |
|
| 2046 |
// Port to bind to if `-bind=addr` is provided without a `:port` suffix.
|
| 2047 |
const uint16_t default_bind_port =
|
|
|
|
| 2083 |
return InitError(ResolveErrMsg("bind", bind_arg));
|
| 2084 |
}
|
| 2085 |
|
| 2086 |
+
NetPermissionFlags all_permission_flags{NetPermissionFlags::None};
|
| 2087 |
for (const std::string& strBind : args.GetArgs("-whitebind")) {
|
| 2088 |
NetWhitebindPermissions whitebind;
|
| 2089 |
bilingual_str error;
|
| 2090 |
if (!NetWhitebindPermissions::TryParse(strBind, whitebind, error)) return InitError(error);
|
| 2091 |
+
NetPermissions::AddFlag(all_permission_flags, whitebind.m_flags);
|
| 2092 |
connOptions.vWhiteBinds.push_back(whitebind);
|
| 2093 |
}
|
| 2094 |
|
|
|
|
| 2105 |
}
|
| 2106 |
}
|
| 2107 |
|
| 2108 |
+
connOptions.listenonion = args.GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION);
|
| 2109 |
+
|
| 2110 |
CService onion_service_target;
|
| 2111 |
if (!connOptions.onion_binds.empty()) {
|
| 2112 |
onion_service_target = connOptions.onion_binds.front();
|
| 2113 |
} else if (!connOptions.vBinds.empty()) {
|
| 2114 |
onion_service_target = connOptions.vBinds.front();
|
| 2115 |
+
if (connOptions.listenonion) {
|
| 2116 |
+
std::string alternate_connections{"clearnet"}, only_from_localhost;
|
| 2117 |
+
if (onion_service_target.IsBindAny()) {
|
| 2118 |
+
only_from_localhost = " from localhost";
|
| 2119 |
+
} else if (onion_service_target.IsLocal()) {
|
| 2120 |
+
alternate_connections = "local";
|
| 2121 |
+
}
|
| 2122 |
+
InitWarning(strprintf(_("You are using a common listening port (%s) for both Tor and %s connections. All connections to this port%s will be assumed to be Tor connections, and will be denied any whitelist permissions. If this is not your intent, setup a separate -bind=<addr>[:<port>]=onion configuration, or set -listenonion=0."),
|
| 2123 |
+
onion_service_target.ToStringAddrPort(),
|
| 2124 |
+
alternate_connections,
|
| 2125 |
+
only_from_localhost));
|
| 2126 |
+
}
|
| 2127 |
} else {
|
| 2128 |
onion_service_target = DefaultOnionServiceTarget(default_bind_port_onion);
|
| 2129 |
connOptions.onion_binds.push_back(onion_service_target);
|
| 2130 |
}
|
| 2131 |
|
| 2132 |
+
if (connOptions.listenonion) {
|
| 2133 |
if (connOptions.onion_binds.size() > 1) {
|
| 2134 |
InitWarning(strprintf(_("More than one onion bind address is provided. Using %s "
|
| 2135 |
"for the automatically created Tor onion service."),
|
|
|
|
| 2144 |
Discover();
|
| 2145 |
}
|
| 2146 |
|
| 2147 |
+
std::vector<std::string> whitelist_opts = args.GetArgs("-whitelist");
|
| 2148 |
+
if ((g_local_services & NODE_BLOOM) != NODE_BLOOM && args.GetBoolArg("-peerbloomfilters", true)) {
|
| 2149 |
+
// If peerbloomfilters isn't specified, enable it only for localhost by default.
|
| 2150 |
+
whitelist_opts.emplace_back("in,out,bloomfilter@127.0.0.0/8");
|
| 2151 |
+
whitelist_opts.emplace_back("in,out,bloomfilter@[::1]/128");
|
| 2152 |
+
}
|
| 2153 |
+
for (const auto& net : whitelist_opts) {
|
| 2154 |
NetWhitelistPermissions subnet;
|
| 2155 |
ConnectionDirection connection_direction;
|
| 2156 |
bilingual_str error;
|
| 2157 |
if (!NetWhitelistPermissions::TryParse(net, subnet, connection_direction, error)) return InitError(error);
|
| 2158 |
+
NetPermissions::AddFlag(all_permission_flags, subnet.m_flags);
|
| 2159 |
if (connection_direction & ConnectionDirection::In) {
|
| 2160 |
connOptions.vWhitelistedRangeIncoming.push_back(subnet);
|
| 2161 |
}
|
|
|
|
| 2164 |
}
|
| 2165 |
}
|
| 2166 |
|
| 2167 |
+
if (NetPermissions::HasFlag(all_permission_flags, NetPermissionFlags::BlockFilters_Explicit) &&
|
| 2168 |
+
g_enabled_filter_types.count(BlockFilterType::BASIC) != 1) {
|
| 2169 |
+
return InitError(_("Cannot grant blockfilters permission without -blockfilterindex."));
|
| 2170 |
+
}
|
| 2171 |
+
|
| 2172 |
connOptions.vSeedNodes = args.GetArgs("-seednode");
|
| 2173 |
|
| 2174 |
const auto connect = args.GetArgs("-connect");
|