mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Have HasDust and PreCheckValidEphemeralTx take CTransaction
This commit is contained in:
parent
04a614bf9a
commit
3ed930a1f4
4 changed files with 7 additions and 7 deletions
|
@ -5,12 +5,12 @@
|
|||
#include <policy/ephemeral_policy.h>
|
||||
#include <policy/policy.h>
|
||||
|
||||
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)) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue