Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

coincontrol.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2015 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 
12 #include <boost/optional.hpp>
13 
14 enum class CoinType
15 {
16  ALL_COINS,
20  ONLY_MASTERNODE_COLLATERAL, // find masternode outputs including locked ones (use with caution)
22  // Attributes
25 };
26 
29 {
30 public:
41  boost::optional<CFeeRate> m_feerate;
43  boost::optional<CFeeRate> m_discard_feerate;
45  boost::optional<unsigned int> m_confirm_target;
50 
52  {
53  SetNull();
54  }
55 
56  void SetNull()
57  {
59  fAllowOtherInputs = false;
60  fRequireAllInputs = true;
61  fAllowWatchOnly = false;
62  setSelected.clear();
63  m_feerate.reset();
64  m_discard_feerate.reset();
65  fOverrideFeeRate = false;
66  m_confirm_target.reset();
69  }
70 
71  bool HasSelected() const
72  {
73  return (setSelected.size() > 0);
74  }
75 
76  bool IsSelected(const COutPoint& output) const
77  {
78  return (setSelected.count(output) > 0);
79  }
80 
81  void Select(const COutPoint& output)
82  {
83  setSelected.insert(output);
84  }
85 
86  void UnSelect(const COutPoint& output)
87  {
88  setSelected.erase(output);
89  }
90 
91  void UnSelectAll()
92  {
93  setSelected.clear();
94  }
95 
96  void ListSelected(std::vector<COutPoint>& vOutpoints) const
97  {
98  vOutpoints.assign(setSelected.begin(), setSelected.end());
99  }
100 
101  // Dash-specific helpers
102 
103  void UsePrivateSend(bool fUsePrivateSend)
104  {
106  }
107 
108  bool IsUsingPrivateSend() const
109  {
111  }
112 
113 private:
114  std::set<COutPoint> setSelected;
115 };
116 
117 #endif // BITCOIN_WALLET_COINCONTROL_H
void UsePrivateSend(bool fUsePrivateSend)
Definition: coincontrol.h:103
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:80
bool fAllowWatchOnly
Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria.
Definition: coincontrol.h:37
boost::optional< unsigned int > m_confirm_target
Override the default confirmation target if set.
Definition: coincontrol.h:45
FeeEstimateMode
Definition: fees.h:97
void ListSelected(std::vector< COutPoint > &vOutpoints) const
Definition: coincontrol.h:96
bool HasSelected() const
Definition: coincontrol.h:71
bool fRequireAllInputs
If false, only include as many inputs as necessary to fulfill a coin selection request. Only usable together with fAllowOtherInputs.
Definition: coincontrol.h:35
CoinType
Definition: coincontrol.h:14
void UnSelect(const COutPoint &output)
Definition: coincontrol.h:86
bool fOverrideFeeRate
Override automatic min/max checks on fee, m_feerate must be set if true.
Definition: coincontrol.h:39
Coin Control Features.
Definition: coincontrol.h:28
boost::optional< CFeeRate > m_feerate
Override the default payTxFee if set.
Definition: coincontrol.h:41
boost::optional< CFeeRate > m_discard_feerate
Override the discard feerate estimation with m_discard_feerate in CreateTransaction if set...
Definition: coincontrol.h:43
std::set< COutPoint > setSelected
Definition: coincontrol.h:114
void SetNull()
Definition: coincontrol.h:56
CTxDestination destChange
Definition: coincontrol.h:31
void Select(const COutPoint &output)
Definition: coincontrol.h:81
bool fAllowOtherInputs
If false, allows unselected inputs, but requires all selected inputs be used if fAllowOtherInputs is ...
Definition: coincontrol.h:33
bool IsUsingPrivateSend() const
Definition: coincontrol.h:108
CoinType nCoinType
Controls which types of coins are allowed to be used (default: ALL_COINS)
Definition: coincontrol.h:49
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:26
void UnSelectAll()
Definition: coincontrol.h:91
bool IsSelected(const COutPoint &output) const
Definition: coincontrol.h:76
FeeEstimateMode m_fee_mode
Fee estimation mode to control arguments to estimateSmartFee.
Definition: coincontrol.h:47
Released under the MIT license