mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
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.
This commit is contained in:
parent
e3de7cb903
commit
4060c50d7e
1 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue