#include <coinselection.h>
Definition at line 330 of file coinselection.h.
◆ SelectionResult() [1/2]
◆ SelectionResult() [2/2]
| wallet::SelectionResult::SelectionResult |
( |
| ) |
|
|
delete |
◆ AddInput()
| void wallet::SelectionResult::AddInput |
( |
const OutputGroup & | group | ) |
|
◆ AddInputs()
| void wallet::SelectionResult::AddInputs |
( |
const OutputSet & | inputs, |
|
|
bool | subtract_fee_outputs ) |
◆ Clear()
| void wallet::SelectionResult::Clear |
( |
| ) |
|
◆ GetAlgo()
◆ GetAlgoCompleted()
| bool wallet::SelectionResult::GetAlgoCompleted |
( |
| ) |
const |
◆ GetChange()
Get the amount for the change output after paying needed fees.
The change amount is not 100% precise due to discrepancies in fee calculation. The final change amount (if any) should be corrected after calculating the final tx fees. When there is a discrepancy, most of the time the final change would be slightly bigger than estimated.
Following are the possible factors of discrepancy:
- non-input fees always include segwit flags
- input fee estimation always include segwit stack size
- input fees are rounded individually and not collectively, which leads to small rounding errors
- input counter size is always assumed to be 1vbyte
- Parameters
-
| [in] | min_viable_change | Minimum amount for change output, if change would be less then we forgo change |
| [in] | change_fee | Fees to include change output in the tx |
- Returns
- Amount for change output, 0 when there is no change.
Definition at line 975 of file coinselection.cpp.
◆ GetInputSet()
| const OutputSet & wallet::SelectionResult::GetInputSet |
( |
| ) |
const |
◆ GetSelectedEffectiveValue()
| CAmount wallet::SelectionResult::GetSelectedEffectiveValue |
( |
| ) |
const |
|
nodiscard |
◆ GetSelectedValue()
| CAmount wallet::SelectionResult::GetSelectedValue |
( |
| ) |
const |
|
nodiscard |
◆ GetSelectionsEvaluated()
| size_t wallet::SelectionResult::GetSelectionsEvaluated |
( |
| ) |
const |
◆ GetShuffledInputVector()
| std::vector< std::shared_ptr< COutput > > wallet::SelectionResult::GetShuffledInputVector |
( |
| ) |
const |
◆ GetTarget()
| CAmount wallet::SelectionResult::GetTarget |
( |
| ) |
const |
|
inline |
◆ GetTotalBumpFees()
| CAmount wallet::SelectionResult::GetTotalBumpFees |
( |
| ) |
const |
|
nodiscard |
◆ GetWaste()
| CAmount wallet::SelectionResult::GetWaste |
( |
| ) |
const |
|
nodiscard |
◆ GetWeight()
| int wallet::SelectionResult::GetWeight |
( |
| ) |
const |
|
inline |
◆ InsertInputs()
| void wallet::SelectionResult::InsertInputs |
( |
const T & | inputs | ) |
|
|
inlineprivate |
◆ Merge()
Combines the.
- Parameters
-
| [in] | other | selection result into 'this' selection result. |
Important note: There must be no shared 'COutput' among the two selection results being combined.
Definition at line 922 of file coinselection.cpp.
◆ operator<()
◆ RecalculateWaste()
| void wallet::SelectionResult::RecalculateWaste |
( |
CAmount | min_viable_change, |
|
|
CAmount | change_cost, |
|
|
CAmount | change_fee ) |
Calculates and stores the waste for this result given the cost of change and the opportunity cost of spending these inputs now vs in the future.
If change exists, waste = change_cost + inputs * (effective_feerate - long_term_feerate) - bump_fee_group_discount If no change, waste = excess + inputs * (effective_feerate - long_term_feerate) - bump_fee_group_discount where excess = selected_effective_value - target change_cost = effective_feerate * change_output_size + long_term_feerate * change_spend_size
- Parameters
-
| [in] | min_viable_change | The minimum amount necessary to make a change output economic |
| [in] | change_cost | The cost of creating a change output and spending it in the future. Only used if there is change, in which case it must be non-negative. |
| [in] | change_fee | The fee for creating a change output |
Definition at line 827 of file coinselection.cpp.
◆ SetAlgoCompleted()
| void wallet::SelectionResult::SetAlgoCompleted |
( |
bool | algo_completed | ) |
|
Tracks that algorithm was able to exhaustively search the entire combination space before hitting limit of tries.
Definition at line 855 of file coinselection.cpp.
◆ SetBumpFeeDiscount()
| void wallet::SelectionResult::SetBumpFeeDiscount |
( |
CAmount | discount | ) |
|
How much individual inputs overestimated the bump fees for shared ancestries.
Definition at line 820 of file coinselection.cpp.
◆ SetSelectionsEvaluated()
| void wallet::SelectionResult::SetSelectionsEvaluated |
( |
size_t | attempts | ) |
|
Record the number of selections that were evaluated.
Definition at line 865 of file coinselection.cpp.
◆ bump_fee_group_discount
| CAmount wallet::SelectionResult::bump_fee_group_discount {0} |
|
private |
How much individual inputs overestimated the bump fees for the shared ancestry.
Definition at line 350 of file coinselection.h.
◆ m_algo
The algorithm used to produce this result.
Definition at line 338 of file coinselection.h.
◆ m_algo_completed
| bool wallet::SelectionResult::m_algo_completed {true} |
|
private |
False if algorithm was cut short by hitting limit of attempts and solution is non-optimal.
Definition at line 344 of file coinselection.h.
◆ m_selected_inputs
| OutputSet wallet::SelectionResult::m_selected_inputs |
|
private |
Set of inputs selected by the algorithm to use in the transaction.
Definition at line 334 of file coinselection.h.
◆ m_selections_evaluated
| size_t wallet::SelectionResult::m_selections_evaluated |
|
private |
The count of selections that were evaluated by this coin selection attempt.
Definition at line 346 of file coinselection.h.
◆ m_target
| CAmount wallet::SelectionResult::m_target |
|
private |
The target the algorithm selected for.
Equal to the recipient amount plus non-input fees
Definition at line 336 of file coinselection.h.
◆ m_use_effective
| bool wallet::SelectionResult::m_use_effective {false} |
|
private |
Whether the input values for calculations should be the effective value (true) or normal value (false).
Definition at line 340 of file coinselection.h.
◆ m_waste
| std::optional<CAmount> wallet::SelectionResult::m_waste |
|
private |
◆ m_weight
| int wallet::SelectionResult::m_weight {0} |
|
private |
The documentation for this struct was generated from the following files: