aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/coinselection.cpp
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2022-07-22 16:16:44 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2022-10-26 15:52:35 -0300
commit295852f61998a025b0b28a0671e6e1cf0dc08d0d (patch)
tree059002052b8d54834f629bd80f8f5fb558708f41 /src/wallet/coinselection.cpp
parent37e7887cb4bfd7db6eb462ed0741c45aea22a990 (diff)
downloadbitcoin-295852f61998a025b0b28a0671e6e1cf0dc08d0d.tar.xz
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)
Diffstat (limited to 'src/wallet/coinselection.cpp')
-rw-r--r--src/wallet/coinselection.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wallet/coinselection.cpp b/src/wallet/coinselection.cpp
index b568e90998..a8be6cd83a 100644
--- a/src/wallet/coinselection.cpp
+++ b/src/wallet/coinselection.cpp
@@ -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;