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. */
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
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.
32 //! Fee estimation mode to control arguments to estimateSmartFee
33 FeeEstimateMode m_fee_mode
;
42 destChange
= CNoDestination();
43 fAllowOtherInputs
= false;
44 fAllowWatchOnly
= false;
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
);
78 void ListSelected(std::vector
<COutPoint
>& vOutpoints
) const
80 vOutpoints
.assign(setSelected
.begin(), setSelected
.end());
84 std::set
<COutPoint
> setSelected
;
87 #endif // BITCOIN_WALLET_COINCONTROL_H