aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/coinselection.h
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2022-03-21 14:19:10 -0400
committerAndrew Chow <achow101-github@achow101.com>2022-04-14 12:40:36 -0400
commit912f1ed181161b0365776cd490b63137aaad708a (patch)
tree40a554a56263010294a661a6f75159e811b94300 /src/wallet/coinselection.h
parentb69fd5eaa99f84b62a49d7c7f48d8cee1227592a (diff)
downloadbitcoin-912f1ed181161b0365776cd490b63137aaad708a.tar.xz
wallet: track which coin selection algorithm produced a SelectionResult
Diffstat (limited to 'src/wallet/coinselection.h')
-rw-r--r--src/wallet/coinselection.h16
1 files changed, 14 insertions, 2 deletions
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<CAmount> 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;