Bitcoin ABC 0.34.2
P2P Digital Currency
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
11#include <optional>
12
13const int DEFAULT_MIN_DEPTH = 0;
14const int DEFAULT_MAX_DEPTH = 9999999;
15
17static constexpr bool DEFAULT_AVOIDPARTIALSPENDS = false;
18
21public:
24 std::optional<OutputType> m_change_type;
37 std::optional<CFeeRate> m_feerate;
39 std::optional<unsigned int> m_confirm_target;
48
50
51 void SetNull();
52
53 bool HasSelected() const { return (setSelected.size() > 0); }
54
55 bool IsSelected(const COutPoint &output) const {
56 return (setSelected.count(output) > 0);
57 }
58
59 void Select(const COutPoint &output) { setSelected.insert(output); }
60
61 void UnSelect(const COutPoint &output) { setSelected.erase(output); }
62
63 void UnSelectAll() { setSelected.clear(); }
64
65 void ListSelected(std::vector<COutPoint> &vOutpoints) const {
66 vOutpoints.assign(setSelected.begin(), setSelected.end());
67 }
68
69private:
70 std::set<COutPoint> setSelected;
71};
72
73#endif // BITCOIN_WALLET_COINCONTROL_H
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
Definition: addresstype.h:54
Coin Control Features.
Definition: coincontrol.h:20
std::optional< OutputType > m_change_type
Override the default change type if set, ignored if destChange is set.
Definition: coincontrol.h:24
bool HasSelected() const
Definition: coincontrol.h:53
std::optional< unsigned int > m_confirm_target
Override the default confirmation target if set.
Definition: coincontrol.h:39
bool IsSelected(const COutPoint &output) const
Definition: coincontrol.h:55
int m_max_depth
Maximum chain depth value for coin availability.
Definition: coincontrol.h:47
void UnSelectAll()
Definition: coincontrol.h:63
void Select(const COutPoint &output)
Definition: coincontrol.h:59
void UnSelect(const COutPoint &output)
Definition: coincontrol.h:61
bool fAllowWatchOnly
Includes watch only addresses which are solvable.
Definition: coincontrol.h:33
int m_min_depth
Minimum chain depth value for coin availability.
Definition: coincontrol.h:45
std::optional< CFeeRate > m_feerate
Override the wallet's m_pay_tx_fee if set.
Definition: coincontrol.h:37
bool fOverrideFeeRate
Override automatic min/max checks on fee, m_feerate must be set if true.
Definition: coincontrol.h:35
bool m_add_inputs
If false, only selected inputs are used.
Definition: coincontrol.h:26
CTxDestination destChange
Definition: coincontrol.h:22
bool m_avoid_address_reuse
Forbids inclusion of dirty (previously used) addresses.
Definition: coincontrol.h:43
void SetNull()
Definition: coincontrol.cpp:9
bool m_include_unsafe_inputs
If false, only safe inputs will be used (confirmed or self transfers)
Definition: coincontrol.h:28
bool m_avoid_partial_spends
Avoid partial use of funds sent to a given address.
Definition: coincontrol.h:41
bool fAllowOtherInputs
If false, allows unselected inputs, but requires all selected inputs be used.
Definition: coincontrol.h:31
void ListSelected(std::vector< COutPoint > &vOutpoints) const
Definition: coincontrol.h:65
std::set< COutPoint > setSelected
Definition: coincontrol.h:70
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:14
static constexpr bool DEFAULT_AVOIDPARTIALSPENDS
Default for -avoidpartialspends.
Definition: coincontrol.h:17
const int DEFAULT_MIN_DEPTH
Definition: coincontrol.h:13