Bitcoin
coincontrol.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2019 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_WALLET_COINCONTROL_H
6 #define BITCOIN_WALLET_COINCONTROL_H
7 
8 #include <policy/feerate.h>
9 #include <policy/fees.h>
10 #include <primitives/transaction.h>
11 #include <wallet/wallet.h>
12 
13 #include <boost/optional.hpp>
14 
17 {
18 public:
22  boost::optional<OutputType> m_change_type;
30  boost::optional<CFeeRate> m_feerate;
32  boost::optional<unsigned int> m_confirm_target;
34  boost::optional<bool> m_signal_bip125_rbf;
42  int m_min_depth{0};
43 
45  {
46  SetNull();
47  }
48 
49  void SetNull();
50 
51  bool HasSelected() const
52  {
53  return (setSelected.size() > 0);
54  }
55 
56  bool IsSelected(const COutPoint& output) const
57  {
58  return (setSelected.count(output) > 0);
59  }
60 
61  void Select(const COutPoint& output)
62  {
63  setSelected.insert(output);
64  }
65 
66  void UnSelect(const COutPoint& output)
67  {
68  setSelected.erase(output);
69  }
70 
71  void UnSelectAll()
72  {
73  setSelected.clear();
74  }
75 
76  void ListSelected(std::vector<COutPoint>& vOutpoints) const
77  {
78  vOutpoints.assign(setSelected.begin(), setSelected.end());
79  }
80 
81 private:
82  std::set<COutPoint> setSelected;
83 };
84 
85 #endif // BITCOIN_WALLET_COINCONTROL_H
CTxDestination destChange
Custom change destination, if not set an address is generated.
Definition: coincontrol.h:20
bool fAllowWatchOnly
Includes watch only addresses which are solvable.
Definition: coincontrol.h:26
FeeEstimateMode m_fee_mode
Fee estimation mode to control arguments to estimateSmartFee.
Definition: coincontrol.h:40
bool IsSelected(const COutPoint &output) const
Definition: coincontrol.h:56
FeeEstimateMode
Definition: fees.h:49
bool HasSelected() const
Definition: coincontrol.h:51
void Select(const COutPoint &output)
Definition: coincontrol.h:61
boost::optional< unsigned int > m_confirm_target
Override the default confirmation target if set.
Definition: coincontrol.h:32
void SetNull()
Definition: coincontrol.cpp:9
boost::optional< bool > m_signal_bip125_rbf
Override the wallet's m_signal_rbf if set.
Definition: coincontrol.h:34
Definition: coincontrol.h:16
bool m_avoid_address_reuse
Forbids inclusion of dirty (previously used) addresses.
Definition: coincontrol.h:38
void ListSelected(std::vector< COutPoint > &vOutpoints) const
Definition: coincontrol.h:76
bool m_avoid_partial_spends
Avoid partial use of funds sent to a given address.
Definition: coincontrol.h:36
std::set< COutPoint > setSelected
Definition: coincontrol.h:82
Definition: transaction.h:18
bool fAllowOtherInputs
If false, allows unselected inputs, but requires all selected inputs be used.
Definition: coincontrol.h:24
bool fOverrideFeeRate
Override automatic min/max checks on fee, m_feerate must be set if true.
Definition: coincontrol.h:28
int m_min_depth
Minimum chain depth value for coin availability.
Definition: coincontrol.h:42
void UnSelectAll()
Definition: coincontrol.h:71
void UnSelect(const COutPoint &output)
Definition: coincontrol.h:66
boost::optional< CFeeRate > m_feerate
Override the wallet's m_pay_tx_fee if set.
Definition: coincontrol.h:30
boost::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
Definition: standard.h:139
boost::optional< OutputType > m_change_type
Override the default change type if set, ignored if destChange is set.
Definition: coincontrol.h:22
CCoinControl()
Definition: coincontrol.h:44