Skip to content

Commit 3ed930a

Browse files
committed
Have HasDust and PreCheckValidEphemeralTx take CTransaction
1 parent 04a614b commit 3ed930a

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/policy/ephemeral_policy.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
#include <policy/ephemeral_policy.h>
66
#include <policy/policy.h>
77

8-
bool HasDust(const CTransactionRef& tx, CFeeRate dust_relay_rate)
8+
bool HasDust(const CTransaction& tx, CFeeRate dust_relay_rate)
99
{
10-
return std::any_of(tx->vout.cbegin(), tx->vout.cend(), [&](const auto& output) { return IsDust(output, dust_relay_rate); });
10+
return std::any_of(tx.vout.cbegin(), tx.vout.cend(), [&](const auto& output) { return IsDust(output, dust_relay_rate); });
1111
}
1212

13-
bool PreCheckEphemeralTx(const CTransactionRef& tx, CFeeRate dust_relay_rate, CAmount base_fee, CAmount mod_fee, TxValidationState& state)
13+
bool PreCheckEphemeralTx(const CTransaction& tx, CFeeRate dust_relay_rate, CAmount base_fee, CAmount mod_fee, TxValidationState& state)
1414
{
1515
// We never want to give incentives to mine this transaction alone
1616
if ((base_fee != 0 || mod_fee != 0) && HasDust(tx, dust_relay_rate)) {

src/policy/ephemeral_policy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
*/
3636

3737
/** Returns true if transaction contains dust */
38-
bool HasDust(const CTransactionRef& tx, CFeeRate dust_relay_rate);
38+
bool HasDust(const CTransaction& tx, CFeeRate dust_relay_rate);
3939

4040
/* All the following checks are only called if standardness rules are being applied. */
4141

4242
/** Must be called for each transaction once transaction fees are known.
4343
* Does context-less checks about a single transaction.
4444
* Returns false if the fee is non-zero and dust exists, populating state. True otherwise.
4545
*/
46-
bool PreCheckEphemeralTx(const CTransactionRef& tx, CFeeRate dust_relay_rate, CAmount base_fee, CAmount mod_fee, TxValidationState& state);
46+
bool PreCheckEphemeralTx(const CTransaction& tx, CFeeRate dust_relay_rate, CAmount base_fee, CAmount mod_fee, TxValidationState& state);
4747

4848
/** Must be called for each transaction(package) if any dust is in the package.
4949
* Checks that each transaction's parents have their dust spent by the child,

src/rpc/mining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ static RPCHelpMan prioritisetransaction()
496496

497497
// Non-0 fee dust transactions are not allowed for entry, and modification not allowed afterwards
498498
const auto& tx = mempool.get(hash);
499-
if (tx && HasDust(tx, mempool.m_opts.dust_relay_feerate)) {
499+
if (tx && HasDust(*tx, mempool.m_opts.dust_relay_feerate)) {
500500
throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is not supported for transactions with dust outputs.");
501501
}
502502

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
915915

916916
// Enforces 0-fee for dust transactions, no incentive to be mined alone
917917
if (m_pool.m_opts.require_standard) {
918-
if (!PreCheckEphemeralTx(ptx, m_pool.m_opts.dust_relay_feerate, ws.m_base_fees, ws.m_modified_fees, state)) {
918+
if (!PreCheckEphemeralTx(*ptx, m_pool.m_opts.dust_relay_feerate, ws.m_base_fees, ws.m_modified_fees, state)) {
919919
return false; // state filled in by PreCheckEphemeralTx
920920
}
921921
}

0 commit comments

Comments
 (0)