mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
[rpc/node] check for high fee before ATMP in clients
Check absurd fee in BroadcastTransaction and RPC, return TransactionError::MAX_FEE_EXCEEDED instead of TxValidationResult::TX_NOT_STANDARD because this is client preference, not a node-wide policy.
This commit is contained in:
@@ -947,12 +947,20 @@ static RPCHelpMan testmempoolaccept()
|
||||
|
||||
TxValidationState state;
|
||||
bool test_accept_res;
|
||||
CAmount fee;
|
||||
CAmount fee{0};
|
||||
{
|
||||
LOCK(cs_main);
|
||||
test_accept_res = AcceptToMemoryPool(mempool, state, std::move(tx),
|
||||
nullptr /* plTxnReplaced */, false /* bypass_limits */, max_raw_tx_fee, /* test_accept */ true, &fee);
|
||||
}
|
||||
|
||||
// Check that fee does not exceed maximum fee
|
||||
if (test_accept_res && max_raw_tx_fee && fee > max_raw_tx_fee) {
|
||||
result_0.pushKV("allowed", false);
|
||||
result_0.pushKV("reject-reason", "max-fee-exceeded");
|
||||
result.push_back(std::move(result_0));
|
||||
return result;
|
||||
}
|
||||
result_0.pushKV("allowed", test_accept_res);
|
||||
|
||||
// Only return the fee and vsize if the transaction would pass ATMP.
|
||||
|
||||
Reference in New Issue
Block a user