Raven Core  3.0.0
P2P Digital Currency
coincontrol.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_WALLET_COINCONTROL_H
7 #define RAVEN_WALLET_COINCONTROL_H
8 
9 #include "policy/feerate.h"
10 #include "policy/fees.h"
11 #include "primitives/transaction.h"
12 #include "wallet/wallet.h"
13 
14 #include <boost/optional.hpp>
15 
18 {
19 public:
28  boost::optional<CFeeRate> m_feerate;
30  boost::optional<unsigned int> m_confirm_target;
32  bool signalRbf;
35 
37  std::string strAssetSelected;
42  {
43  SetNull();
44  }
45 
46  void SetNull()
47  {
48  destChange = CNoDestination();
49  fAllowOtherInputs = false;
50  fAllowWatchOnly = false;
51  setSelected.clear();
52  m_feerate.reset();
53  fOverrideFeeRate = false;
54  m_confirm_target.reset();
55  signalRbf = fWalletRbf;
56  m_fee_mode = FeeEstimateMode::UNSET;
57  strAssetSelected = "";
58  setAssetsSelected.clear();
59  }
60 
61  bool HasSelected() const
62  {
63  return (setSelected.size() > 0);
64  }
65 
66  bool HasAssetSelected() const
67  {
68  return (setAssetsSelected.size() > 0);
69  }
70 
71  bool IsSelected(const COutPoint& output) const
72  {
73  return (setSelected.count(output) > 0);
74  }
75 
76  bool IsAssetSelected(const COutPoint& output) const
77  {
78  return (setAssetsSelected.count(output) > 0);
79  }
80 
81  void Select(const COutPoint& output)
82  {
83  setSelected.insert(output);
84  }
85 
86  void SelectAsset(const COutPoint& output)
87  {
88  setAssetsSelected.insert(output);
89  }
90 
91 
92  void UnSelect(const COutPoint& output)
93  {
94  setSelected.erase(output);
95  if (!setSelected.size())
96  strAssetSelected = "";
97  }
98 
99  void UnSelectAsset(const COutPoint& output)
100  {
101  setAssetsSelected.erase(output);
102  if (!setSelected.size())
103  strAssetSelected = "";
104  }
105 
106  void UnSelectAll()
107  {
108  setSelected.clear();
109  strAssetSelected = "";
110  setAssetsSelected.clear();
111  }
112 
113  void ListSelected(std::vector<COutPoint>& vOutpoints) const
114  {
115  vOutpoints.assign(setSelected.begin(), setSelected.end());
116  }
117 
118  void ListSelectedAssets(std::vector<COutPoint>& vOutpoints) const
119  {
120  vOutpoints.assign(setAssetsSelected.begin(), setAssetsSelected.end());
121  }
122 
123 private:
124  std::set<COutPoint> setSelected;
125  std::set<COutPoint> setAssetsSelected;
126 };
127 
128 #endif // RAVEN_WALLET_COINCONTROL_H
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:89
bool fAllowWatchOnly
Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria.
Definition: coincontrol.h:24
std::string strAssetSelected
RVN START.
Definition: coincontrol.h:38
boost::optional< unsigned int > m_confirm_target
Override the default confirmation target if set.
Definition: coincontrol.h:30
FeeEstimateMode
Definition: fees.h:98
void ListSelected(std::vector< COutPoint > &vOutpoints) const
Definition: coincontrol.h:113
bool HasSelected() const
Definition: coincontrol.h:61
void UnSelect(const COutPoint &output)
Definition: coincontrol.h:92
bool fOverrideFeeRate
Override automatic min/max checks on fee, m_feerate must be set if true.
Definition: coincontrol.h:26
Coin Control Features.
Definition: coincontrol.h:17
boost::optional< CFeeRate > m_feerate
Override the default payTxFee if set.
Definition: coincontrol.h:28
bool IsAssetSelected(const COutPoint &output) const
Definition: coincontrol.h:76
std::set< COutPoint > setSelected
Definition: coincontrol.h:124
bool signalRbf
Signal BIP-125 replace by fee.
Definition: coincontrol.h:32
bool fWalletRbf
Definition: wallet.cpp:49
void SetNull()
Definition: coincontrol.h:46
CTxDestination destChange
Definition: coincontrol.h:20
void Select(const COutPoint &output)
Definition: coincontrol.h:81
bool fAllowOtherInputs
If false, allows unselected inputs, but requires all selected inputs be used.
Definition: coincontrol.h:22
CCoinControl()
RVN END.
Definition: coincontrol.h:41
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:22
void UnSelectAll()
Definition: coincontrol.h:106
void ListSelectedAssets(std::vector< COutPoint > &vOutpoints) const
Definition: coincontrol.h:118
bool HasAssetSelected() const
Definition: coincontrol.h:66
bool IsSelected(const COutPoint &output) const
Definition: coincontrol.h:71
std::set< COutPoint > setAssetsSelected
Definition: coincontrol.h:125
FeeEstimateMode m_fee_mode
Fee estimation mode to control arguments to estimateSmartFee.
Definition: coincontrol.h:34
void UnSelectAsset(const COutPoint &output)
Definition: coincontrol.h:99
void SelectAsset(const COutPoint &output)
Definition: coincontrol.h:86