Bitcoin ABC  0.22.12
P2P Digital Currency
coincontrol.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 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 <outputtype.h>
10 #include <script/standard.h>
11 
12 const int DEFAULT_MIN_DEPTH = 0;
13 const int DEFAULT_MAX_DEPTH = 9999999;
14 
16 static constexpr bool DEFAULT_AVOIDPARTIALSPENDS = false;
17 
19 class CCoinControl {
20 public:
23  std::optional<OutputType> m_change_type;
34  std::optional<CFeeRate> m_feerate;
36  std::optional<unsigned int> m_confirm_target;
45 
47 
48  void SetNull();
49 
50  bool HasSelected() const { return (setSelected.size() > 0); }
51 
52  bool IsSelected(const COutPoint &output) const {
53  return (setSelected.count(output) > 0);
54  }
55 
56  void Select(const COutPoint &output) { setSelected.insert(output); }
57 
58  void UnSelect(const COutPoint &output) { setSelected.erase(output); }
59 
60  void UnSelectAll() { setSelected.clear(); }
61 
62  void ListSelected(std::vector<COutPoint> &vOutpoints) const {
63  vOutpoints.assign(setSelected.begin(), setSelected.end());
64  }
65 
66 private:
67  std::set<COutPoint> setSelected;
68 };
69 
70 #endif // BITCOIN_WALLET_COINCONTROL_H
bool fAllowWatchOnly
Includes watch only addresses which are solvable.
Definition: coincontrol.h:30
void ListSelected(std::vector< COutPoint > &vOutpoints) const
Definition: coincontrol.h:62
bool HasSelected() const
Definition: coincontrol.h:50
int m_min_depth
Minimum chain depth value for coin availability.
Definition: coincontrol.h:42
void UnSelect(const COutPoint &output)
Definition: coincontrol.h:58
bool fOverrideFeeRate
Override automatic min/max checks on fee, m_feerate must be set if true.
Definition: coincontrol.h:32
Coin Control Features.
Definition: coincontrol.h:19
bool m_avoid_partial_spends
Avoid partial use of funds sent to a given address.
Definition: coincontrol.h:38
std::set< COutPoint > setSelected
Definition: coincontrol.h:67
const int DEFAULT_MAX_DEPTH
Definition: coincontrol.h:13
bool m_add_inputs
If false, only selected inputs are used.
Definition: coincontrol.h:25
void SetNull()
Definition: coincontrol.cpp:9
CTxDestination destChange
Definition: coincontrol.h:21
void Select(const COutPoint &output)
Definition: coincontrol.h:56
bool fAllowOtherInputs
If false, allows unselected inputs, but requires all selected inputs be used.
Definition: coincontrol.h:28
const int DEFAULT_MIN_DEPTH
Definition: coincontrol.h:12
bool m_avoid_address_reuse
Forbids inclusion of dirty (previously used) addresses.
Definition: coincontrol.h:40
static constexpr bool DEFAULT_AVOIDPARTIALSPENDS
Default for -avoidpartialspends.
Definition: coincontrol.h:16
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:22
void UnSelectAll()
Definition: coincontrol.h:60
std::optional< unsigned int > m_confirm_target
Override the default confirmation target if set.
Definition: coincontrol.h:36
int m_max_depth
Maximum chain depth value for coin availability.
Definition: coincontrol.h:44
std::optional< CFeeRate > m_feerate
Override the wallet&#39;s m_pay_tx_fee if set.
Definition: coincontrol.h:34
bool IsSelected(const COutPoint &output) const
Definition: coincontrol.h:52
std::optional< OutputType > m_change_type
Override the default change type if set, ignored if destChange is set.
Definition: coincontrol.h:23
boost::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:87