5#ifndef BITCOIN_WALLET_COINSELECTION_H
6#define BITCOIN_WALLET_COINSELECTION_H
21 throw std::invalid_argument(
"tx should not be null");
23 if (i >= tx->vout.size()) {
24 throw std::out_of_range(
"The output index is out of range");
76 bool include_partial_groups)
105 const Amount &target_value,
const Amount &cost_of_change,
106 std::set<CInputCoin> &out_set,
Amount &value_ret,
107 const Amount not_input_fees);
111 std::set<CInputCoin> &setCoinsRet,
Amount &nValueRet);
static constexpr Amount COIN
Fee rate in satoshis per kilobyte: Amount / kB.
An outpoint - a combination of a transaction hash and an index n into its vout.
An output of a transaction.
static constexpr Amount MIN_CHANGE
target minimum change amount
static const Amount MIN_FINAL_CHANGE
final minimum change amount after paying for fees
bool KnapsackSolver(const Amount nTargetValue, std::vector< OutputGroup > &groups, std::set< CInputCoin > &setCoinsRet, Amount &nValueRet)
bool SelectCoinsBnB(std::vector< OutputGroup > &utxo_pool, const Amount &target_value, const Amount &cost_of_change, std::set< CInputCoin > &out_set, Amount &value_ret, const Amount not_input_fees)
This is the Branch and Bound Coin Selection algorithm designed by Murch.
std::shared_ptr< const CTransaction > CTransactionRef
static constexpr Amount zero() noexcept
CoinEligibilityFilter(int conf_mine_, int conf_theirs_, bool include_partial_groups)
const int conf_theirs
Minimum number of confirmations for outputs received from a different wallet.
CoinEligibilityFilter(int conf_mine_, int conf_theirs_)
const bool m_include_partial_groups
Include partial destination groups when avoid_reuse and there are full groups.
std::vector< CInputCoin > m_outputs
CFeeRate m_long_term_feerate
CFeeRate m_effective_feerate
void Insert(const CInputCoin &output, int depth, bool from_me, bool positive_only)
OutputGroup(const CFeeRate &effective_feerate, const CFeeRate &long_term_feerate)
bool EligibleForSpending(const CoinEligibilityFilter &eligibility_filter) const