Skip to content

Commit 4e68f90

Browse files
committed
rpc: disallow in-mempool prioritisation of dusty tx
1 parent e1d3e81 commit 4e68f90

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/rpc/mining.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <node/context.h>
2424
#include <node/miner.h>
2525
#include <node/warnings.h>
26+
#include <policy/ephemeral_policy.h>
2627
#include <pow.h>
2728
#include <rpc/blockchain.h>
2829
#include <rpc/mining.h>
@@ -491,7 +492,15 @@ static RPCHelpMan prioritisetransaction()
491492
throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is no longer supported, dummy argument to prioritisetransaction must be 0.");
492493
}
493494

494-
EnsureAnyMemPool(request.context).PrioritiseTransaction(hash, nAmount);
495+
CTxMemPool& mempool = EnsureAnyMemPool(request.context);
496+
497+
// Non-0 fee dust transactions are not allowed for entry, and modification not allowed afterwards
498+
const auto& tx = mempool.get(hash);
499+
if (tx && HasDust(tx, mempool.m_opts.dust_relay_feerate)) {
500+
throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is not supported for transactions with dust outputs.");
501+
}
502+
503+
mempool.PrioritiseTransaction(hash, nAmount);
495504
return true;
496505
},
497506
};

0 commit comments

Comments
 (0)