Use MakeUnique<Db>(...)
[bitcoinplatinum.git] / src / wallet / coincontrol.h
blobfc0e7c519ed012637f301e7dd8e692848d1f57f2
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.
5 #ifndef BITCOIN_WALLET_COINCONTROL_H
6 #define BITCOIN_WALLET_COINCONTROL_H
8 #include "policy/feerate.h"
9 #include "policy/fees.h"
10 #include "primitives/transaction.h"
11 #include "wallet/wallet.h"
13 #include <boost/optional.hpp>
15 /** Coin Control Features. */
16 class CCoinControl
18 public:
19 CTxDestination destChange;
20 //! If false, allows unselected inputs, but requires all selected inputs be used
21 bool fAllowOtherInputs;
22 //! Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria
23 bool fAllowWatchOnly;
24 //! Override automatic min/max checks on fee, m_feerate must be set if true
25 bool fOverrideFeeRate;
26 //! Override the default payTxFee if set
27 boost::optional<CFeeRate> m_feerate;
28 //! Override the default confirmation target if set
29 boost::optional<unsigned int> m_confirm_target;
30 //! Signal BIP-125 replace by fee.
31 bool signalRbf;
32 //! Fee estimation mode to control arguments to estimateSmartFee
33 FeeEstimateMode m_fee_mode;
35 CCoinControl()
37 SetNull();
40 void SetNull()
42 destChange = CNoDestination();
43 fAllowOtherInputs = false;
44 fAllowWatchOnly = false;
45 setSelected.clear();
46 m_feerate.reset();
47 fOverrideFeeRate = false;
48 m_confirm_target.reset();
49 signalRbf = fWalletRbf;
50 m_fee_mode = FeeEstimateMode::UNSET;
53 bool HasSelected() const
55 return (setSelected.size() > 0);
58 bool IsSelected(const COutPoint& output) const
60 return (setSelected.count(output) > 0);
63 void Select(const COutPoint& output)
65 setSelected.insert(output);
68 void UnSelect(const COutPoint& output)
70 setSelected.erase(output);
73 void UnSelectAll()
75 setSelected.clear();
78 void ListSelected(std::vector<COutPoint>& vOutpoints) const
80 vOutpoints.assign(setSelected.begin(), setSelected.end());
83 private:
84 std::set<COutPoint> setSelected;
87 #endif // BITCOIN_WALLET_COINCONTROL_H