Skip to content

Commit e8f7ae5

Browse files
committed
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.
1 parent 51a9c00 commit e8f7ae5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/wallet/spend.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ bool SelectCoins(const CWallet& wallet, const std::vector<COutput>& vAvailableCo
443443
// calculate value from preset inputs and store them
444444
std::set<CInputCoin> setPresetCoins;
445445
CAmount nValueFromPresetInputs = 0;
446+
OutputGroup preset_inputs(coin_selection_params);
446447

447448
std::vector<COutPoint> vPresetInputs;
448449
coin_control.ListSelected(vPresetInputs);
@@ -480,6 +481,10 @@ bool SelectCoins(const CWallet& wallet, const std::vector<COutput>& vAvailableCo
480481
value_to_select -= coin.effective_value;
481482
}
482483
setPresetCoins.insert(coin);
484+
/* 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.
485+
* positive_only is set to false because we want to include all preset inputs, even if they are dust.
486+
*/
487+
preset_inputs.Insert(coin, 0, false, 0, 0, false);
483488
}
484489

485490
// remove preset inputs from vCoins so that Coin Selection doesn't pick them.

0 commit comments

Comments
 (0)