5 #ifndef BITCOIN_WALLET_COINSELECTION_H 6 #define BITCOIN_WALLET_COINSELECTION_H 13 static constexpr
CAmount MIN_CHANGE{COIN / 100};
15 static const CAmount MIN_FINAL_CHANGE = MIN_CHANGE/2;
22 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");
80 OutputGroup(std::vector<CInputCoin>&& outputs,
bool from_me,
CAmount value,
int depth,
size_t ancestors,
size_t descendants)
89 Insert(output, depth, from_me, ancestors, descendants);
91 void Insert(
const CInputCoin& output,
int depth,
bool from_me,
size_t ancestors,
size_t descendants);
99 bool KnapsackSolver(
const CAmount& nTargetValue, std::vector<OutputGroup>& groups, std::set<CInputCoin>& setCoinsRet,
CAmount& nValueRet);
101 #endif // BITCOIN_WALLET_COINSELECTION_H
bool SelectCoinsBnB(std::vector< OutputGroup > &utxo_pool, const CAmount &target_value, const CAmount &cost_of_change, std::set< CInputCoin > &out_set, CAmount &value_ret, CAmount not_input_fees)
bool KnapsackSolver(const CAmount &nTargetValue, std::vector< OutputGroup > &groups, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet)
const uint64_t max_descendants
std::shared_ptr< const CTransaction > CTransactionRef
std::vector< CInputCoin >::iterator Discard(const CInputCoin &output)
CoinEligibilityFilter(int conf_mine, int conf_theirs, uint64_t max_ancestors)
int64_t CAmount
Amount in satoshis (Can be negative)
OutputGroup(std::vector< CInputCoin > &&outputs, bool from_me, CAmount value, int depth, size_t ancestors, size_t descendants)
void Insert(const CInputCoin &output, int depth, bool from_me, size_t ancestors, size_t descendants)
const uint64_t max_ancestors
std::vector< CInputCoin > m_outputs
An output of a transaction.
An outpoint - a combination of a transaction hash and an index n into its vout.
CoinEligibilityFilter(int conf_mine, int conf_theirs, uint64_t max_ancestors, uint64_t max_descendants)
bool EligibleForSpending(const CoinEligibilityFilter &eligibility_filter) const
OutputGroup(const CInputCoin &output, int depth, bool from_me, size_t ancestors, size_t descendants)