Bitcoin Core  0.20.99
P2P Digital Currency
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 <optional.h>
9 #include <outputtype.h>
10 #include <policy/feerate.h>
11 #include <policy/fees.h>
12 #include <primitives/transaction.h>
13 #include <script/standard.h>
14 
15 const int DEFAULT_MIN_DEPTH = 0;
16 const int DEFAULT_MAX_DEPTH = 9999999;
17 
19 static constexpr bool DEFAULT_AVOIDPARTIALSPENDS = false;
20 
23 {
24 public:
53 
55  {
56  SetNull();
57  }
58 
59  void SetNull();
60 
61  bool HasSelected() const
62  {
63  return (setSelected.size() > 0);
64  }
65 
66  bool IsSelected(const COutPoint& output) const
67  {
68  return (setSelected.count(output) > 0);
69  }
70 
71  void Select(const COutPoint& output)
72  {
73  setSelected.insert(output);
74  }
75 
76  void UnSelect(const COutPoint& output)
77  {
78  setSelected.erase(output);
79  }
80 
81  void UnSelectAll()
82  {
83  setSelected.clear();
84  }
85 
86  void ListSelected(std::vector<COutPoint>& vOutpoints) const
87  {
88  vOutpoints.assign(setSelected.begin(), setSelected.end());
89  }
90 
91 private:
92  std::set<COutPoint> setSelected;
93 };
94 
95 #endif // BITCOIN_WALLET_COINCONTROL_H
bool fAllowWatchOnly
Includes watch only addresses which are solvable.
Definition: coincontrol.h:34
void ListSelected(std::vector< COutPoint > &vOutpoints) const
Definition: coincontrol.h:86
bool HasSelected() const
Definition: coincontrol.h:61
int m_min_depth
Minimum chain depth value for coin availability.
Definition: coincontrol.h:50
void UnSelect(const COutPoint &output)
Definition: coincontrol.h:76
bool fOverrideFeeRate
Override automatic min/max checks on fee, m_feerate must be set if true.
Definition: coincontrol.h:36
Coin Control Features.
Definition: coincontrol.h:22
bool m_avoid_partial_spends
Avoid partial use of funds sent to a given address.
Definition: coincontrol.h:44
std::set< COutPoint > setSelected
Definition: coincontrol.h:92
Optional< bool > m_signal_bip125_rbf
Override the wallet&#39;s m_signal_rbf if set.
Definition: coincontrol.h:42
const int DEFAULT_MAX_DEPTH
Definition: coincontrol.h:16
bool m_add_inputs
If false, only selected inputs are used.
Definition: coincontrol.h:30
void SetNull()
Definition: coincontrol.cpp:9
CTxDestination destChange
Custom change destination, if not set an address is generated.
Definition: coincontrol.h:26
void Select(const COutPoint &output)
Definition: coincontrol.h:71
bool fAllowOtherInputs
If false, allows unselected inputs, but requires all selected inputs be used.
Definition: coincontrol.h:32
FeeEstimateMode
Definition: feerate.h:18
const int DEFAULT_MIN_DEPTH
Definition: coincontrol.h:15
Optional< unsigned int > m_confirm_target
Override the default confirmation target if set.
Definition: coincontrol.h:40
bool m_avoid_address_reuse
Forbids inclusion of dirty (previously used) addresses.
Definition: coincontrol.h:46
static constexpr bool DEFAULT_AVOIDPARTIALSPENDS
Default for -avoidpartialspends.
Definition: coincontrol.h:19
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:18
void UnSelectAll()
Definition: coincontrol.h:81
int m_max_depth
Maximum chain depth value for coin availability.
Definition: coincontrol.h:52
bool IsSelected(const COutPoint &output) const
Definition: coincontrol.h:66
FeeEstimateMode m_fee_mode
Fee estimation mode to control arguments to estimateSmartFee.
Definition: coincontrol.h:48
Optional< CFeeRate > m_feerate
Override the wallet&#39;s m_pay_tx_fee if set.
Definition: coincontrol.h:38
Optional< OutputType > m_change_type
Override the default change type if set, ignored if destChange is set.
Definition: coincontrol.h:28
boost::optional< T > Optional
Substitute for C++17 std::optional.
Definition: optional.h:14
boost::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:209