aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2021-10-05 15:49:06 -0400
committerAndrew Chow <achow101-github@achow101.com>2022-01-24 11:23:31 -0500
commit4060c50d7ee31dc8a39229e3553d3d92f8f3516d (patch)
treee130ab3737cc8c66cb481682f25012876ac7739b
parente3de7cb9039770e0fd5b8bb8a5cba35c87ae8f00 (diff)
wallet: add input weights to CCoinControl
In order to allow coin selection to take weights from the user, CCoinControl needs to be able to set and get them.
-rw-r--r--src/wallet/coincontrol.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/wallet/coincontrol.h b/src/wallet/coincontrol.h
index 5ef2295c88..65a5c83366 100644
--- a/src/wallet/coincontrol.h
+++ b/src/wallet/coincontrol.h
@@ -115,9 +115,28 @@ public:
vOutpoints.assign(setSelected.begin(), setSelected.end());
}
+ void SetInputWeight(const COutPoint& outpoint, int64_t weight)
+ {
+ m_input_weights[outpoint] = weight;
+ }
+
+ bool HasInputWeight(const COutPoint& outpoint) const
+ {
+ return m_input_weights.count(outpoint) > 0;
+ }
+
+ int64_t GetInputWeight(const COutPoint& outpoint) const
+ {
+ auto it = m_input_weights.find(outpoint);
+ assert(it != m_input_weights.end());
+ return it->second;
+ }
+
private:
std::set<COutPoint> setSelected;
std::map<COutPoint, CTxOut> m_external_txouts;
+ //! Map of COutPoints to the maximum weight for that input
+ std::map<COutPoint, int64_t> m_input_weights;
};
} // namespace wallet