diff --git a/src/policy/ephemeral_policy.cpp b/src/policy/ephemeral_policy.cpp index eadc1d24752..67421683ab9 100644 --- a/src/policy/ephemeral_policy.cpp +++ b/src/policy/ephemeral_policy.cpp @@ -5,12 +5,12 @@ #include #include -bool HasDust(const CTransactionRef& tx, CFeeRate dust_relay_rate) +bool HasDust(const CTransaction& tx, CFeeRate dust_relay_rate) { - return std::any_of(tx->vout.cbegin(), tx->vout.cend(), [&](const auto& output) { return IsDust(output, dust_relay_rate); }); + return std::any_of(tx.vout.cbegin(), tx.vout.cend(), [&](const auto& output) { return IsDust(output, dust_relay_rate); }); } -bool PreCheckEphemeralTx(const CTransactionRef& tx, CFeeRate dust_relay_rate, CAmount base_fee, CAmount mod_fee, TxValidationState& state) +bool PreCheckEphemeralTx(const CTransaction& tx, CFeeRate dust_relay_rate, CAmount base_fee, CAmount mod_fee, TxValidationState& state) { // We never want to give incentives to mine this transaction alone if ((base_fee != 0 || mod_fee != 0) && HasDust(tx, dust_relay_rate)) { diff --git a/src/policy/ephemeral_policy.h b/src/policy/ephemeral_policy.h index 65dbab48e25..0ed4a54eb70 100644 --- a/src/policy/ephemeral_policy.h +++ b/src/policy/ephemeral_policy.h @@ -35,7 +35,7 @@ */ /** Returns true if transaction contains dust */ -bool HasDust(const CTransactionRef& tx, CFeeRate dust_relay_rate); +bool HasDust(const CTransaction& tx, CFeeRate dust_relay_rate); /* All the following checks are only called if standardness rules are being applied. */ @@ -43,7 +43,7 @@ bool HasDust(const CTransactionRef& tx, CFeeRate dust_relay_rate); * Does context-less checks about a single transaction. * Returns false if the fee is non-zero and dust exists, populating state. True otherwise. */ -bool PreCheckEphemeralTx(const CTransactionRef& tx, CFeeRate dust_relay_rate, CAmount base_fee, CAmount mod_fee, TxValidationState& state); +bool PreCheckEphemeralTx(const CTransaction& tx, CFeeRate dust_relay_rate, CAmount base_fee, CAmount mod_fee, TxValidationState& state); /** Must be called for each transaction(package) if any dust is in the package. * Checks that each transaction's parents have their dust spent by the child, diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 006ec3c78c7..d4491ab1080 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -496,7 +496,7 @@ static RPCHelpMan prioritisetransaction() // Non-0 fee dust transactions are not allowed for entry, and modification not allowed afterwards const auto& tx = mempool.get(hash); - if (tx && HasDust(tx, mempool.m_opts.dust_relay_feerate)) { + if (tx && HasDust(*tx, mempool.m_opts.dust_relay_feerate)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is not supported for transactions with dust outputs."); } diff --git a/src/validation.cpp b/src/validation.cpp index 1510200abf0..91a9d02611e 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -915,7 +915,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws) // Enforces 0-fee for dust transactions, no incentive to be mined alone if (m_pool.m_opts.require_standard) { - if (!PreCheckEphemeralTx(ptx, m_pool.m_opts.dust_relay_feerate, ws.m_base_fees, ws.m_modified_fees, state)) { + if (!PreCheckEphemeralTx(*ptx, m_pool.m_opts.dust_relay_feerate, ws.m_base_fees, ws.m_modified_fees, state)) { return false; // state filled in by PreCheckEphemeralTx } }