v31.1-roots.1 · Commit 7: [PATCH 07/17] feat(rpc): preserve Roots operator interfaces on v31
src/rpc/mempool.cpp
Before: src/rpc/mempool.cpp · After: src/rpc/mempool.cpp
File metadata
index aba4b4cd135431feddad2063fbe7f3dab1952ce0..3eb61bdcada4d6b73b987c320f697d3f8e8bbfd8 100644
Download original patch · Release notes
Diff rows 1–106 of 106. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
src/rpc/mempool.cpp
CHANGED
|
@@ -1051,13 +1051,69 @@ UniValue MempoolInfoToJSON(const CTxMemPool& pool)
|
|
|
1051
1051
|
ret.pushKV("limitclustercount", pool.m_opts.limits.cluster_count);
|
|
1052
1052
|
ret.pushKV("limitclustersize", pool.m_opts.limits.cluster_size_vbytes);
|
|
1053
1053
|
ret.pushKV("optimal", pool.m_txgraph->DoWork(0)); // 0 work is a quick check for known optimality
|
|
1054
|
+
// Startup controls are initialized before RPC warmup finishes. The live dust
|
|
1055
|
+
// rate shares the existing mempool critical section with the other fields.
|
|
1056
|
+
const auto& opts{pool.m_opts};
|
|
1057
|
+
UniValue policy{UniValue::VOBJ};
|
|
1058
|
+
policy.pushKV("require_standard", opts.require_standard);
|
|
1059
|
+
policy.pushKV("max_script_size", g_script_size_policy_limit);
|
|
1060
|
+
policy.pushKV("bytes_per_sigop", nBytesPerSigOp);
|
|
1061
|
+
policy.pushKV("bytes_per_sigop_strict", nBytesPerSigOpStrict);
|
|
1062
|
+
policy.pushKV("max_tx_legacy_sigops", opts.maxtxlegacysigops);
|
|
1063
|
+
policy.pushKV("datacarrier", opts.max_datacarrier_bytes.has_value());
|
|
1064
|
+
policy.pushKV("max_datacarrier_bytes", opts.max_datacarrier_bytes.value_or(0));
|
|
1065
|
+
policy.pushKV("datacarrier_fullcount", opts.datacarrier_fullcount);
|
|
1066
|
+
policy.pushKV("datacarrier_weight_per_byte", opts.weight_per_data_byte);
|
|
1067
|
+
policy.pushKV("accept_nonstd_datacarrier", opts.accept_non_std_datacarrier);
|
|
1068
|
+
policy.pushKV("permit_bare_datacarrier", opts.permitbaredatacarrier);
|
|
1069
|
+
policy.pushKV("dust_relay_fee", ValueFromAmount(pool.GetDustRelayFee().GetFeePerK()));
|
|
1070
|
+
policy.pushKV("subdust_fee_penalty", opts.subdustfeepenalty);
|
|
1071
|
+
policy.pushKV("permit_bare_pubkey", opts.permit_bare_pubkey);
|
|
1072
|
+
policy.pushKV("permit_bare_multisig", opts.permit_bare_multisig);
|
|
1073
|
+
policy.pushKV("reject_parasites", opts.reject_parasites);
|
|
1074
|
+
policy.pushKV("reject_tokens", opts.reject_tokens);
|
|
1075
|
+
policy.pushKV("accept_unknown_witness", opts.acceptunknownwitness);
|
|
1076
|
+
policy.pushKV("permit_bare_anchor", opts.permitbareanchor);
|
|
1077
|
+
policy.pushKV("ephemeral_anchor", opts.permitephemeral_anchor);
|
|
1078
|
+
policy.pushKV("ephemeral_dust", opts.permitephemeral_dust);
|
|
1079
|
+
policy.pushKV("ephemeral_send", opts.permitephemeral_send);
|
|
1080
|
+
switch (opts.rbf_policy) {
|
|
1081
|
+
case RBFPolicy::Never:
|
|
1082
|
+
policy.pushKV("replacement", "never");
|
|
1083
|
+
break;
|
|
1084
|
+
case RBFPolicy::OptIn:
|
|
1085
|
+
policy.pushKV("replacement", "optin");
|
|
1086
|
+
break;
|
|
1087
|
+
case RBFPolicy::Always:
|
|
1088
|
+
policy.pushKV("replacement", "always");
|
|
1089
|
+
break;
|
|
1090
|
+
}
|
|
1091
|
+
switch (opts.truc_policy) {
|
|
1092
|
+
case TRUCPolicy::Reject:
|
|
1093
|
+
policy.pushKV("truc", "reject");
|
|
1094
|
+
break;
|
|
1095
|
+
case TRUCPolicy::Accept:
|
|
1096
|
+
policy.pushKV("truc", "accept");
|
|
1097
|
+
break;
|
|
1098
|
+
case TRUCPolicy::Enforce:
|
|
1099
|
+
policy.pushKV("truc", "enforce");
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
1102
|
+
policy.pushKV("min_relay_coinblocks", opts.minrelaycoinblocks);
|
|
1103
|
+
policy.pushKV("min_relay_maturity", opts.minrelaymaturity);
|
|
1104
|
+
policy.pushKV("spk_reuse", opts.reject_spk_reuse ? "conflict" : "allow");
|
|
1105
|
+
ret.pushKV("policy", std::move(policy));
|
|
1054
1106
|
return ret;
|
|
1055
1107
|
}
|
|
1056
1108
|
|
|
1057
1109
|
static RPCHelpMan getmempoolinfo()
|
|
1058
1110
|
{
|
|
1059
1111
|
return RPCHelpMan{"getmempoolinfo",
|
|
1060
|
-
"Returns details on the active state of the TX memory pool.",
|
|
1112
|
+
"Returns details on the active state of the TX memory pool.\n"
|
|
1113
|
+
"The policy object reports initialized local admission controls, not consensus rules or mining limits.\n"
|
|
1114
|
+
"Controls are startup-only, except the live dust rate; this RPC does not change policy.\n"
|
|
1115
|
+
"Settings gated by require_standard remain visible when that gate is false. Other admission checks still apply.\n"
|
|
1116
|
+
"All policy fields are present; clients should allow additional fields. Values share the mempool observation, not a cross-RPC snapshot.",
|
|
1061
1117
|
{},
|
|
1062
1118
|
RPCResult{
|
|
1063
1119
|
RPCResult::Type::OBJ, "", "",
|
|
@@ -1078,6 +1134,36 @@ static RPCHelpMan getmempoolinfo()
|
|
|
1078
1134
|
{RPCResult::Type::NUM, "limitclustercount", "Maximum number of transactions that can be in a cluster (configured by -limitclustercount)"},
|
|
1079
1135
|
{RPCResult::Type::NUM, "limitclustersize", "Maximum size of a cluster in virtual bytes (configured by -limitclustersize)"},
|
|
1080
1136
|
{RPCResult::Type::BOOL, "optimal", "If the mempool is in a known-optimal transaction ordering"},
|
|
1137
|
+
{RPCResult::Type::OBJ, "policy", "Initialized local mempool admission controls. Allow flags are permissions, not unconditional acceptance guarantees",
|
|
1138
|
+
{
|
|
1139
|
+
{RPCResult::Type::BOOL, "require_standard", "Enable transaction/input/witness standardness checks (default: true)"},
|
|
1140
|
+
{RPCResult::Type::NUM, "max_script_size", "Script policy bound in bytes under standardness; scriptSig is also capped at 1650 bytes. Zero is a zero-byte bound (default: 1650)"},
|
|
1141
|
+
{RPCResult::Type::NUM, "bytes_per_sigop", "Policy virtual bytes per sigop; zero removes this size contribution (default: 20)"},
|
|
1142
|
+
{RPCResult::Type::NUM, "bytes_per_sigop_strict", "Accurate sigop density bound in equivalent bytes per sigop, independent of standardness; zero disables this additional check (default: 20)"},
|
|
1143
|
+
{RPCResult::Type::NUM, "max_tx_legacy_sigops", "Legacy transaction sigop bound under standardness; zero is a zero-sigop bound (default: 2500)"},
|
|
1144
|
+
{RPCResult::Type::BOOL, "datacarrier", "Whether an OP_RETURN carrier budget exists; false denies carriers under standardness/full-count checking (default: true)"},
|
|
1145
|
+
{RPCResult::Type::NUM, "max_datacarrier_bytes", "Aggregate serialized carrier budget in bytes; zero when disabled or explicitly set to zero (default: 83)"},
|
|
1146
|
+
{RPCResult::Type::BOOL, "datacarrier_fullcount", "Include recognized input/witness carriers in the aggregate budget independently of standardness (default: true)"},
|
|
1147
|
+
{RPCResult::Type::NUM, "datacarrier_weight_per_byte", "Rounded-up weight units per detected data byte, adding only weight in excess of its existing weight; zero adds none (default: 4)"},
|
|
1148
|
+
{RPCResult::Type::BOOL, "accept_nonstd_datacarrier", "Permit recognized nonstandard carriers independently of standardness; the full-count budget still applies (default: false)"},
|
|
1149
|
+
{RPCResult::Type::BOOL, "permit_bare_datacarrier", "Permit carrier-only transactions under standardness (default: false)"},
|
|
1150
|
+
{RPCResult::Type::STR_AMOUNT, "dust_relay_fee", "Live dust threshold rate in " + CURRENCY_UNIT + "/kvB, also used by the sub-dust fee penalty; zero makes thresholds zero (default: 0.00003000)"},
|
|
1151
|
+
{RPCResult::Type::BOOL, "subdust_fee_penalty", "Subtract accumulated output dust shortfalls from policy modified fees independently of standardness (default: true)"},
|
|
1152
|
+
{RPCResult::Type::BOOL, "permit_bare_pubkey", "Permit bare pubkey outputs under standardness (default: false)"},
|
|
1153
|
+
{RPCResult::Type::BOOL, "permit_bare_multisig", "Permit bare multisig outputs under standardness (default: false)"},
|
|
1154
|
+
{RPCResult::Type::BOOL, "reject_parasites", "Reject the CAT21 locktime marker under standardness (default: true)"},
|
|
1155
|
+
{RPCResult::Type::BOOL, "reject_tokens", "Enable recognized token filters under standardness (default: false)"},
|
|
1156
|
+
{RPCResult::Type::BOOL, "accept_unknown_witness", "Permit unknown witness output versions under standardness (default: true)"},
|
|
1157
|
+
{RPCResult::Type::BOOL, "permit_bare_anchor", "Permit anchor-only transactions under standardness (default: true)"},
|
|
1158
|
+
{RPCResult::Type::BOOL, "ephemeral_anchor", "Permit anchor outputs under standardness (default: true)"},
|
|
1159
|
+
{RPCResult::Type::BOOL, "ephemeral_dust", "Permit nonzero ephemeral dust under standardness, subject to other dust/package rules (default: false)"},
|
|
1160
|
+
{RPCResult::Type::BOOL, "ephemeral_send", "Permit non-anchor dust under standardness, subject to other dust/package rules (default: false)"},
|
|
1161
|
+
{RPCResult::Type::STR, "replacement", "Resolved replacement mode: never, optin, or always. Opt-in also permits non-signaling TRUC/v3 replacement (default: always)"},
|
|
1162
|
+
{RPCResult::Type::STR, "truc", "Resolved local v3 policy: reject, accept, or enforce (default: enforce)"},
|
|
1163
|
+
{RPCResult::Type::NUM, "min_relay_coinblocks", "Minimum input value times confirmation age in satoshi-blocks; zero disables this restriction (default: 0)"},
|
|
1164
|
+
{RPCResult::Type::NUM, "min_relay_maturity", "Minimum input age in blocks, measured at the next block height; zero disables this restriction (default: 0)"},
|
|
1165
|
+
{RPCResult::Type::STR, "spk_reuse", "Initialized script reuse mode for mempool policy conflicts: allow or conflict (default: allow)"},
|
|
1166
|
+
}},
|
|
1081
1167
|
}},
|
|
1082
1168
|
RPCExamples{
|
|
1083
1169
|
HelpExampleCli("getmempoolinfo", "")
|