From 912f1ed181161b0365776cd490b63137aaad708a Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 21 Mar 2022 14:19:10 -0400 Subject: wallet: track which coin selection algorithm produced a SelectionResult --- src/wallet/coinselection.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/wallet/coinselection.h') diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h index c1484c0a57..44eec9a417 100644 --- a/src/wallet/coinselection.h +++ b/src/wallet/coinselection.h @@ -239,6 +239,16 @@ struct OutputGroup */ [[nodiscard]] CAmount GenerateChangeTarget(CAmount payment_value, FastRandomContext& rng); +enum class SelectionAlgorithm : uint8_t +{ + BNB = 0, + KNAPSACK = 1, + SRD = 2, + MANUAL = 3, +}; + +std::string GetAlgorithmName(const SelectionAlgorithm algo); + struct SelectionResult { private: @@ -250,10 +260,12 @@ private: bool m_use_effective{false}; /** The computed waste */ std::optional m_waste; + /** The algorithm used to produce this result */ + SelectionAlgorithm m_algo; public: - explicit SelectionResult(const CAmount target) - : m_target(target) {} + explicit SelectionResult(const CAmount target, SelectionAlgorithm algo) + : m_target(target), m_algo(algo) {} SelectionResult() = delete; -- cgit v1.2.3