Bitcoin Core 28.99.0
P2P Digital Currency
|
#include <consensus/validation.h>
#include <policy/ephemeral_policy.h>
#include <policy/feerate.h>
#include <policy/packages.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <txmempool.h>
#include <util/check.h>
#include <util/hasher.h>
#include <algorithm>
#include <cstdint>
#include <map>
#include <memory>
#include <unordered_set>
#include <utility>
#include <vector>
Go to the source code of this file.
Functions | |
bool | PreCheckEphemeralTx (const CTransaction &tx, CFeeRate dust_relay_rate, CAmount base_fee, CAmount mod_fee, TxValidationState &state) |
These utility functions ensure that ephemeral dust is safely created and spent without unduly risking them entering the utxo set. More... | |
bool | CheckEphemeralSpends (const Package &package, CFeeRate dust_relay_rate, const CTxMemPool &tx_pool, TxValidationState &out_child_state, Txid &out_child_txid) |
Must be called for each transaction(package) if any dust is in the package. More... | |
bool CheckEphemeralSpends | ( | const Package & | package, |
CFeeRate | dust_relay_rate, | ||
const CTxMemPool & | tx_pool, | ||
TxValidationState & | out_child_state, | ||
Txid & | out_child_txid | ||
) |
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, where parents are either in the mempool or in the package itself. Sets out_child_state and out_child_txid on failure.
Definition at line 33 of file ephemeral_policy.cpp.
bool PreCheckEphemeralTx | ( | const CTransaction & | tx, |
CFeeRate | dust_relay_rate, | ||
CAmount | base_fee, | ||
CAmount | mod_fee, | ||
TxValidationState & | state | ||
) |
These utility functions ensure that ephemeral dust is safely created and spent without unduly risking them entering the utxo set.
This is ensured by requiring:
Imagine three transactions: TxA, 0-fee with two outputs, one non-dust, one dust TxB, spends TxA's non-dust TxC, spends TxA's dust
All the dust is spent if TxA+TxB+TxC is accepted, but the mining template may just pick up TxA+TxB rather than the three "legal configurations": 1) None 2) TxA+TxB+TxC 3) TxA+TxC By requiring the child transaction to sweep any dust from the parent txn, we ensure that there is a single child only, and this child, or the child's descendants, are the only way to bring fees. Must be called for each transaction once transaction fees are known. Does context-less checks about a single transaction.
Definition at line 23 of file ephemeral_policy.cpp.