Bitcoin Core  27.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
wallet::CoinSelectionParams Struct Reference

Parameters for one iteration of Coin Selection. More...

#include <coinselection.h>

Collaboration diagram for wallet::CoinSelectionParams:
[legend]

Public Member Functions

 CoinSelectionParams (FastRandomContext &rng_fast, size_t change_output_size, size_t change_spend_size, CAmount min_change_target, CFeeRate effective_feerate, CFeeRate long_term_feerate, CFeeRate discard_feerate, size_t tx_noinputs_size, bool avoid_partial)
 
 CoinSelectionParams (FastRandomContext &rng_fast)
 

Public Attributes

FastRandomContextrng_fast
 Randomness to use in the context of coin selection. More...
 
size_t change_output_size = 0
 Size of a change output in bytes, determined by the output type. More...
 
size_t change_spend_size = 0
 Size of the input to spend a change output in virtual bytes. More...
 
CAmount m_min_change_target {0}
 Mininmum change to target in Knapsack solver and CoinGrinder: select coins to cover the payment and at least this value of change. More...
 
CAmount min_viable_change {0}
 Minimum amount for creating a change output. More...
 
CAmount m_change_fee {0}
 Cost of creating the change output. More...
 
CAmount m_cost_of_change {0}
 Cost of creating the change output + cost of spending the change output in the future. More...
 
CFeeRate m_effective_feerate
 The targeted feerate of the transaction being built. More...
 
CFeeRate m_long_term_feerate
 The feerate estimate used to estimate an upper bound on what should be sufficient to spend the change output sometime in the future. More...
 
CFeeRate m_discard_feerate
 If the cost to spend a change output at the discard feerate exceeds its value, drop it to fees. More...
 
size_t tx_noinputs_size = 0
 Size of the transaction before coin selection, consisting of the header and recipient output(s), excluding the inputs and change output(s). More...
 
bool m_subtract_fee_outputs = false
 Indicate that we are subtracting the fee from outputs. More...
 
bool m_avoid_partial_spends = false
 When true, always spend all (up to OUTPUT_GROUP_MAX_ENTRIES) or none of the outputs associated with the same address. More...
 
bool m_include_unsafe_inputs = false
 When true, allow unsafe coins to be selected during Coin Selection. More...
 

Detailed Description

Parameters for one iteration of Coin Selection.

Definition at line 138 of file coinselection.h.

Constructor & Destructor Documentation

◆ CoinSelectionParams() [1/2]

wallet::CoinSelectionParams::CoinSelectionParams ( FastRandomContext rng_fast,
size_t  change_output_size,
size_t  change_spend_size,
CAmount  min_change_target,
CFeeRate  effective_feerate,
CFeeRate  long_term_feerate,
CFeeRate  discard_feerate,
size_t  tx_noinputs_size,
bool  avoid_partial 
)
inline

Definition at line 178 of file coinselection.h.

◆ CoinSelectionParams() [2/2]

wallet::CoinSelectionParams::CoinSelectionParams ( FastRandomContext rng_fast)
inline

Definition at line 192 of file coinselection.h.

Member Data Documentation

◆ change_output_size

size_t wallet::CoinSelectionParams::change_output_size = 0

Size of a change output in bytes, determined by the output type.

Definition at line 142 of file coinselection.h.

◆ change_spend_size

size_t wallet::CoinSelectionParams::change_spend_size = 0

Size of the input to spend a change output in virtual bytes.

Definition at line 144 of file coinselection.h.

◆ m_avoid_partial_spends

bool wallet::CoinSelectionParams::m_avoid_partial_spends = false

When true, always spend all (up to OUTPUT_GROUP_MAX_ENTRIES) or none of the outputs associated with the same address.

This helps reduce privacy leaks resulting from address reuse. Dust outputs are not eligible to be added to output groups and thus not considered.

Definition at line 171 of file coinselection.h.

◆ m_change_fee

CAmount wallet::CoinSelectionParams::m_change_fee {0}

Cost of creating the change output.

Definition at line 153 of file coinselection.h.

◆ m_cost_of_change

CAmount wallet::CoinSelectionParams::m_cost_of_change {0}

Cost of creating the change output + cost of spending the change output in the future.

Definition at line 155 of file coinselection.h.

◆ m_discard_feerate

CFeeRate wallet::CoinSelectionParams::m_discard_feerate

If the cost to spend a change output at the discard feerate exceeds its value, drop it to fees.

Definition at line 162 of file coinselection.h.

◆ m_effective_feerate

CFeeRate wallet::CoinSelectionParams::m_effective_feerate

The targeted feerate of the transaction being built.

Definition at line 157 of file coinselection.h.

◆ m_include_unsafe_inputs

bool wallet::CoinSelectionParams::m_include_unsafe_inputs = false

When true, allow unsafe coins to be selected during Coin Selection.

This may spend unconfirmed outputs: 1) Received from other wallets, 2) replacing other txs, 3) that have been replaced.

Definition at line 176 of file coinselection.h.

◆ m_long_term_feerate

CFeeRate wallet::CoinSelectionParams::m_long_term_feerate

The feerate estimate used to estimate an upper bound on what should be sufficient to spend the change output sometime in the future.

Definition at line 160 of file coinselection.h.

◆ m_min_change_target

CAmount wallet::CoinSelectionParams::m_min_change_target {0}

Mininmum change to target in Knapsack solver and CoinGrinder: select coins to cover the payment and at least this value of change.

Definition at line 147 of file coinselection.h.

◆ m_subtract_fee_outputs

bool wallet::CoinSelectionParams::m_subtract_fee_outputs = false

Indicate that we are subtracting the fee from outputs.

Definition at line 167 of file coinselection.h.

◆ min_viable_change

CAmount wallet::CoinSelectionParams::min_viable_change {0}

Minimum amount for creating a change output.

If change budget is smaller than min_change then we forgo creation of change output.

Definition at line 151 of file coinselection.h.

◆ rng_fast

FastRandomContext& wallet::CoinSelectionParams::rng_fast

Randomness to use in the context of coin selection.

Definition at line 140 of file coinselection.h.

◆ tx_noinputs_size

size_t wallet::CoinSelectionParams::tx_noinputs_size = 0

Size of the transaction before coin selection, consisting of the header and recipient output(s), excluding the inputs and change output(s).

Definition at line 165 of file coinselection.h.


The documentation for this struct was generated from the following file: