Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
coincontrol.h
Go to the documentation of this file.
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.
4
5#ifndef BITCOIN_WALLET_COINCONTROL_H
6#define BITCOIN_WALLET_COINCONTROL_H
7
8#include <outputtype.h>
10#include <script/standard.h>
11
12#include <optional>
13
14const int DEFAULT_MIN_DEPTH = 0;
15const int DEFAULT_MAX_DEPTH = 9999999;
16
18static constexpr bool DEFAULT_AVOIDPARTIALSPENDS = false;
19
22public:
25 std::optional<OutputType> m_change_type;
38 std::optional<CFeeRate> m_feerate;
40 std::optional<unsigned int> m_confirm_target;
49
51
52 void SetNull();
53
54 bool HasSelected() const { return (setSelected.size() > 0); }
55
56 bool IsSelected(const COutPoint &output) const {
57 return (setSelected.count(output) > 0);
58 }
59
60 void Select(const COutPoint &output) { setSelected.insert(output); }
61
62 void UnSelect(const COutPoint &output) { setSelected.erase(output); }
63
64 void UnSelectAll() { setSelected.clear(); }
65
66 void ListSelected(std::vector<COutPoint> &vOutpoints) const {
67 vOutpoints.assign(setSelected.begin(), setSelected.end());
68 }
69
70private:
71 std::set<COutPoint> setSelected;
72};
73
74#endif // BITCOIN_WALLET_COINCONTROL_H
Coin Control Features.
Definition coincontrol.h:21
std::optional< OutputType > m_change_type
Override the default change type if set, ignored if destChange is set.
Definition coincontrol.h:25
bool HasSelected() const
Definition coincontrol.h:54
std::optional< unsigned int > m_confirm_target
Override the default confirmation target if set.
Definition coincontrol.h:40
bool IsSelected(const COutPoint &output) const
Definition coincontrol.h:56
int m_max_depth
Maximum chain depth value for coin availability.
Definition coincontrol.h:48
void UnSelectAll()
Definition coincontrol.h:64
void Select(const COutPoint &output)
Definition coincontrol.h:60
void UnSelect(const COutPoint &output)
Definition coincontrol.h:62
bool fAllowWatchOnly
Includes watch only addresses which are solvable.
Definition coincontrol.h:34
int m_min_depth
Minimum chain depth value for coin availability.
Definition coincontrol.h:46
std::optional< CFeeRate > m_feerate
Override the wallet's m_pay_tx_fee if set.
Definition coincontrol.h:38
bool fOverrideFeeRate
Override automatic min/max checks on fee, m_feerate must be set if true.
Definition coincontrol.h:36
bool m_add_inputs
If false, only selected inputs are used.
Definition coincontrol.h:27
CTxDestination destChange
Definition coincontrol.h:23
bool m_avoid_address_reuse
Forbids inclusion of dirty (previously used) addresses.
Definition coincontrol.h:44
bool m_include_unsafe_inputs
If false, only safe inputs will be used (confirmed or self transfers)
Definition coincontrol.h:29
bool m_avoid_partial_spends
Avoid partial use of funds sent to a given address.
Definition coincontrol.h:42
bool fAllowOtherInputs
If false, allows unselected inputs, but requires all selected inputs be used.
Definition coincontrol.h:32
void ListSelected(std::vector< COutPoint > &vOutpoints) const
Definition coincontrol.h:66
std::set< COutPoint > setSelected
Definition coincontrol.h:71
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition transaction.h:20
const int DEFAULT_MAX_DEPTH
Definition coincontrol.h:15
static constexpr bool DEFAULT_AVOIDPARTIALSPENDS
Default for -avoidpartialspends.
Definition coincontrol.h:18
const int DEFAULT_MIN_DEPTH
Definition coincontrol.h:14
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
Definition standard.h:85