#include <coinselection.h>
|
| template<typename T > |
| void | InsertInputs (const T &inputs) |
| |
| CAmount | GetSelectionWaste (CAmount change_cost, CAmount target, bool use_effective_value=true) |
| | Compute the waste for this result given the cost of change and the opportunity cost of spending these inputs now vs in the future. More...
|
| |
Definition at line 319 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 std::set< std::shared_ptr< COutput >> & |
inputs, |
|
|
bool |
subtract_fee_outputs |
|
) |
| |
◆ Clear()
| void wallet::SelectionResult::Clear |
( |
| ) |
|
◆ ComputeAndSetWaste()
| void wallet::SelectionResult::ComputeAndSetWaste |
( |
const CAmount |
min_viable_change, |
|
|
const CAmount |
change_cost, |
|
|
const CAmount |
change_fee |
|
) |
| |
Calculates and stores the waste for this selection via GetSelectionWaste.
Definition at line 501 of file coinselection.cpp.
◆ GetAlgo()
◆ GetChange()
| CAmount wallet::SelectionResult::GetChange |
( |
const CAmount |
min_viable_change, |
|
|
const CAmount |
change_fee |
|
) |
| const |
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 611 of file coinselection.cpp.
◆ GetInputSet()
| const std::set< std::shared_ptr< COutput > > & wallet::SelectionResult::GetInputSet |
( |
| ) |
const |
◆ GetSelectedEffectiveValue()
| CAmount wallet::SelectionResult::GetSelectedEffectiveValue |
( |
| ) |
const |
◆ GetSelectedValue()
| CAmount wallet::SelectionResult::GetSelectedValue |
( |
| ) |
const |
◆ GetSelectionWaste()
| CAmount wallet::SelectionResult::GetSelectionWaste |
( |
CAmount |
change_cost, |
|
|
CAmount |
target, |
|
|
bool |
use_effective_value = true |
|
) |
| |
|
private |
Compute 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) If no change, waste = excess + inputs * (effective_feerate - long_term_feerate) where excess = selected_effective_value - target change_cost = effective_feerate * change_output_size + long_term_feerate * change_spend_size
- Parameters
-
| [in] | change_cost | The cost of creating change and spending it in the future. Only used if there is change, in which case it must be positive. Must be 0 if there is no change. |
| [in] | target | The amount targeted by the coin selection algorithm. |
| [in] | use_effective_value | Whether to use the input's effective value (when true) or the real value (when false). |
- Returns
- The waste
Definition at line 453 of file coinselection.cpp.
◆ GetShuffledInputVector()
| std::vector< std::shared_ptr< COutput > > wallet::SelectionResult::GetShuffledInputVector |
( |
| ) |
const |
◆ GetTarget()
| CAmount wallet::SelectionResult::GetTarget |
( |
| ) |
const |
|
inline |
◆ GetTotalBumpFees()
| CAmount wallet::SelectionResult::GetTotalBumpFees |
( |
| ) |
const |
◆ GetWaste()
| CAmount wallet::SelectionResult::GetWaste |
( |
| ) |
const |
◆ GetWeight()
| int wallet::SelectionResult::GetWeight |
( |
| ) |
const |
|
inline |
◆ InsertInputs()
template<typename T >
| 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 559 of file coinselection.cpp.
◆ operator<()
◆ SetBumpFeeDiscount()
| void wallet::SelectionResult::SetBumpFeeDiscount |
( |
const CAmount |
discount | ) |
|
How much individual inputs overestimated the bump fees for shared ancestries.
Definition at line 493 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 335 of file coinselection.h.
◆ m_algo
The algorithm used to produce this result.
Definition at line 327 of file coinselection.h.
◆ m_selected_inputs
| std::set<std::shared_ptr<COutput> > wallet::SelectionResult::m_selected_inputs |
|
private |
Set of inputs selected by the algorithm to use in the transaction.
Definition at line 323 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 325 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 329 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: