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");
67 uint64_t max_ancestors_)
68 : conf_mine(conf_mine_), conf_theirs(conf_theirs_),
69 max_ancestors(max_ancestors_), max_descendants(max_ancestors_) {}
71 uint64_t max_ancestors_, uint64_t max_descendants_)
72 : conf_mine(conf_mine_), conf_theirs(conf_theirs_),
73 max_ancestors(max_ancestors_), max_descendants(max_descendants_) {}
81 size_t m_ancestors{0};
82 size_t m_descendants{0};
89 int depth,
size_t ancestors,
size_t descendants)
90 : m_outputs(
std::move(outputs)), m_from_me(from_me), m_value(value),
91 m_depth(depth), m_ancestors(ancestors), m_descendants(descendants) {}
93 size_t ancestors,
size_t descendants)
95 Insert(output, depth, from_me, ancestors, descendants);
97 void Insert(
const CInputCoin &output,
int depth,
bool from_me,
98 size_t ancestors,
size_t descendants);
99 std::vector<CInputCoin>::iterator Discard(
const CInputCoin &output);
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);
113 #endif // BITCOIN_WALLET_COINSELECTION_H std::shared_ptr< const CTransaction > CTransactionRef
static constexpr Amount zero()
OutputGroup(std::vector< CInputCoin > &&outputs, bool from_me, Amount value, int depth, size_t ancestors, size_t descendants)
CoinEligibilityFilter(int conf_mine_, int conf_theirs_, uint64_t max_ancestors_, uint64_t max_descendants_)
const uint64_t max_descendants
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)
const uint64_t max_ancestors
static constexpr Amount COIN
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.
OutputGroup(const CInputCoin &output, int depth, bool from_me, size_t ancestors, size_t descendants)
static constexpr Amount MIN_CHANGE
target minimum change amount
static const Amount MIN_FINAL_CHANGE
final minimum change amount after paying for fees
CoinEligibilityFilter(int conf_mine_, int conf_theirs_, uint64_t max_ancestors_)