@@ -133,6 +133,11 @@ static RPCHelpMan testmempoolaccept()
133
133
{" maxfeerate" , RPCArg::Type::AMOUNT, RPCArg::Default{FormatMoney (DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK ())},
134
134
" Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT +
135
135
" /kvB.\n Fee rates larger than 1BTC/kvB are rejected.\n Set to 0 to accept any fee rate." },
136
+ {" ignore_rejects" , RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, " Rejection conditions to ignore, eg 'txn-mempool-conflict'" ,
137
+ {
138
+ {" reject_reason" , RPCArg::Type::STR, RPCArg::Optional::OMITTED, " " },
139
+ },
140
+ },
136
141
},
137
142
RPCResult{
138
143
RPCResult::Type::ARR, " " , " The result of the mempool acceptance test for each raw transaction in the input array.\n "
@@ -179,6 +184,16 @@ static RPCHelpMan testmempoolaccept()
179
184
180
185
const CFeeRate max_raw_tx_fee_rate{ParseFeeRate (self.Arg <UniValue>(" maxfeerate" ))};
181
186
187
+ const UniValue* json_ign_rejs = &request.params [2 ];
188
+ ignore_rejects_type ignore_rejects;
189
+ if (!json_ign_rejs->isNull ()) {
190
+ for (size_t i = 0 ; i < json_ign_rejs->size (); ++i) {
191
+ const UniValue& json_ign_rej = (*json_ign_rejs)[i];
192
+ const std::string& ign_rej = json_ign_rej.get_str ();
193
+ ignore_rejects.insert (ign_rej);
194
+ }
195
+ }
196
+
182
197
std::vector<CTransactionRef> txns;
183
198
txns.reserve (raw_transactions.size ());
184
199
for (const auto & rawtx : raw_transactions.getValues ()) {
@@ -196,9 +211,9 @@ static RPCHelpMan testmempoolaccept()
196
211
Chainstate& chainstate = chainman.ActiveChainstate ();
197
212
const PackageMempoolAcceptResult package_result = [&] {
198
213
LOCK (::cs_main);
199
- if (txns.size () > 1 ) return ProcessNewPackage (chainstate, mempool, txns, /* test_accept=*/ true , /* client_maxfeerate=*/ {});
214
+ if (txns.size () > 1 ) return ProcessNewPackage (chainstate, mempool, txns, /* test_accept=*/ true , /* client_maxfeerate=*/ {}, ignore_rejects );
200
215
return PackageMempoolAcceptResult (txns[0 ]->GetWitnessHash (),
201
- chainman.ProcessTransaction (txns[0 ], /* test_accept=*/ true ));
216
+ chainman.ProcessTransaction (txns[0 ], /* test_accept=*/ true , ignore_rejects ));
202
217
}();
203
218
204
219
UniValue rpc_result (UniValue::VARR);
@@ -228,7 +243,8 @@ static RPCHelpMan testmempoolaccept()
228
243
// Check that fee does not exceed maximum fee
229
244
const int64_t virtual_size = tx_result.m_vsize .value ();
230
245
const CAmount max_raw_tx_fee = max_raw_tx_fee_rate.GetFee (virtual_size);
231
- if (max_raw_tx_fee && fee > max_raw_tx_fee) {
246
+ if (max_raw_tx_fee && fee > max_raw_tx_fee &&
247
+ 0 == (ignore_rejects.count (" absurdly-high-fee" ) + ignore_rejects.count (" max-fee-exceeded" ))) {
232
248
result_inner.pushKV (" allowed" , false );
233
249
result_inner.pushKV (" reject-reason" , " max-fee-exceeded" );
234
250
exit_early = true ;
0 commit comments