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