wallet: encapsulate pre-selected-inputs lookup into its own function

First step towards decoupling the pre-selected-inputs fetching functionality
from `SelectCoins`. Which, will let us not waste resources calculating the
available coins if one of the pre-set inputs has an error.

(right now, if one of the pre-set inputs is invalid, we first walk through
the entire wallet txes map just to end up failing right after it finish)
This commit is contained in:
furszy
2022-07-22 16:16:44 -03:00
parent 37e7887cb4
commit 295852f619
4 changed files with 82 additions and 51 deletions

View File

@@ -444,6 +444,12 @@ void SelectionResult::AddInput(const OutputGroup& group)
m_use_effective = !group.m_subtract_fee_outputs;
}
void SelectionResult::AddInputs(const std::set<COutput>& inputs, bool subtract_fee_outputs)
{
util::insert(m_selected_inputs, inputs);
m_use_effective = !subtract_fee_outputs;
}
void SelectionResult::Merge(const SelectionResult& other)
{
m_target += other.m_target;