]> Git Repo - VerusCoin.git/blob - src/coincontrol.h
Ensure export finalization edge case
[VerusCoin.git] / src / coincontrol.h
1 // Copyright (c) 2011-2013 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or https://www.opensource.org/licenses/mit-license.php .
4
5 #ifndef BITCOIN_COINCONTROL_H
6 #define BITCOIN_COINCONTROL_H
7
8 #include "primitives/transaction.h"
9
10 /** Coin Control Features. */
11 class CCoinControl
12 {
13 public:
14     CTxDestination destChange;
15     //! If false, allows unselected inputs, but requires all selected inputs be used
16     bool fAllowOtherInputs;
17
18     CCoinControl()
19     {
20         SetNull();
21     }
22
23     void SetNull()
24     {
25         destChange = CNoDestination();
26         fAllowOtherInputs = false;
27         setSelected.clear();
28     }
29
30     bool HasSelected() const
31     {
32         return (setSelected.size() > 0);
33     }
34
35     bool IsSelected(const uint256& hash, unsigned int n) const
36     {
37         COutPoint outpt(hash, n);
38         return (setSelected.count(outpt) > 0);
39     }
40
41     void Select(const COutPoint& output)
42     {
43         setSelected.insert(output);
44     }
45
46     void UnSelect(const COutPoint& output)
47     {
48         setSelected.erase(output);
49     }
50
51     void UnSelectAll()
52     {
53         setSelected.clear();
54     }
55
56     void ListSelected(std::vector<COutPoint>& vOutpoints) const
57     {
58         vOutpoints.assign(setSelected.begin(), setSelected.end());
59     }
60
61 private:
62     std::set<COutPoint> setSelected;
63 };
64
65 #endif // BITCOIN_COINCONTROL_H
This page took 0.024341 seconds and 4 git commands to generate.