mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-30 05:52:33 +02:00
Make an OutputGroup for preset inputs
In SelectCoins, for our preset inputs, we combine all of the preset inputs into a single OutputGroup. This allows us to combine the preset inputs with additional selection algo results.
This commit is contained in:
parent
51a9c00b4d
commit
e8f7ae5eb3
@ -443,6 +443,7 @@ bool SelectCoins(const CWallet& wallet, const std::vector<COutput>& vAvailableCo
|
|||||||
// calculate value from preset inputs and store them
|
// calculate value from preset inputs and store them
|
||||||
std::set<CInputCoin> setPresetCoins;
|
std::set<CInputCoin> setPresetCoins;
|
||||||
CAmount nValueFromPresetInputs = 0;
|
CAmount nValueFromPresetInputs = 0;
|
||||||
|
OutputGroup preset_inputs(coin_selection_params);
|
||||||
|
|
||||||
std::vector<COutPoint> vPresetInputs;
|
std::vector<COutPoint> vPresetInputs;
|
||||||
coin_control.ListSelected(vPresetInputs);
|
coin_control.ListSelected(vPresetInputs);
|
||||||
@ -480,6 +481,10 @@ bool SelectCoins(const CWallet& wallet, const std::vector<COutput>& vAvailableCo
|
|||||||
value_to_select -= coin.effective_value;
|
value_to_select -= coin.effective_value;
|
||||||
}
|
}
|
||||||
setPresetCoins.insert(coin);
|
setPresetCoins.insert(coin);
|
||||||
|
/* Set depth, from_me, ancestors, and descendants to 0 or false as don't matter for preset inputs as no actual selection is being done.
|
||||||
|
* positive_only is set to false because we want to include all preset inputs, even if they are dust.
|
||||||
|
*/
|
||||||
|
preset_inputs.Insert(coin, 0, false, 0, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove preset inputs from vCoins so that Coin Selection doesn't pick them.
|
// remove preset inputs from vCoins so that Coin Selection doesn't pick them.
|
||||||
|
Loading…
Reference in New Issue
Block a user