PRCYCoin  2.0.0.7rc1
P2P Digital Currency
coincontrol.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Copyright (c) 2014-2016 The Dash developers
3 // Copyright (c) 2015-2018 The PIVX developers
4 // Copyright (c) 2018-2020 The DAPS Project developers
5 // Distributed under the MIT/X11 software license, see the accompanying
6 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 
8 #ifndef BITCOIN_COINCONTROL_H
9 #define BITCOIN_COINCONTROL_H
10 
11 #include "primitives/transaction.h"
12 #include "script/standard.h"
13 
16 {
17 public:
20  CKey txPriv;//for change UTXO
21  bool useSwiftTX;
30 
32  {
33  SetNull();
34  }
35 
36  void SetNull()
37  {
39  setSelected.clear();
40  useSwiftTX = false;
41  fAllowOtherInputs = false;
42  fAllowWatchOnly = true;
43  nMinimumTotalFee = 0;
44  fSplitBlock = false;
45  nSplitBlock = 1;
46  }
47 
48  bool HasSelected() const
49  {
50  return (setSelected.size() > 0);
51  }
52 
53  bool IsSelected(const uint256& hash, unsigned int n) const
54  {
55  COutPoint outpt(hash, n);
56  return (setSelected.count(outpt) > 0);
57  }
58 
59  void Select(const COutPoint& output)
60  {
61  setSelected.insert(output);
62  }
63 
64  void UnSelect(const COutPoint& output)
65  {
66  setSelected.erase(output);
67  }
68 
69  void UnSelectAll()
70  {
71  setSelected.clear();
72  }
73 
74  void ListSelected(std::vector<COutPoint>& vOutpoints)
75  {
76  vOutpoints.assign(setSelected.begin(), setSelected.end());
77  }
78 
79  unsigned int QuantitySelected()
80  {
81  return setSelected.size();
82  }
83 
84  void SetSelection(std::set<COutPoint> setSelected)
85  {
86  this->setSelected.clear();
87  this->setSelected = setSelected;
88  }
89 
90 private:
91  std::set<COutPoint> setSelected;
92 };
93 
94 #endif // BITCOIN_COINCONTROL_H
CCoinControl::receiver
CPubKey receiver
Definition: coincontrol.h:19
CCoinControl::Select
void Select(const COutPoint &output)
Definition: coincontrol.h:59
CCoinControl::fAllowOtherInputs
bool fAllowOtherInputs
If false, allows unselected inputs, but requires all selected inputs be used.
Definition: coincontrol.h:25
CCoinControl::IsSelected
bool IsSelected(const uint256 &hash, unsigned int n) const
Definition: coincontrol.h:53
CCoinControl::CCoinControl
CCoinControl()
Definition: coincontrol.h:31
transaction.h
CCoinControl::SetSelection
void SetSelection(std::set< COutPoint > setSelected)
Definition: coincontrol.h:84
CCoinControl::ListSelected
void ListSelected(std::vector< COutPoint > &vOutpoints)
Definition: coincontrol.h:74
CCoinControl
Coin Control Features.
Definition: coincontrol.h:15
CCoinControl::HasSelected
bool HasSelected() const
Definition: coincontrol.h:48
CCoinControl::fAllowWatchOnly
bool fAllowWatchOnly
Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria.
Definition: coincontrol.h:27
CCoinControl::UnSelectAll
void UnSelectAll()
Definition: coincontrol.h:69
CAmount
int64_t CAmount
Amount in PRCY (Can be negative)
Definition: amount.h:17
standard.h
CCoinControl::setSelected
std::set< COutPoint > setSelected
Definition: coincontrol.h:91
CCoinControl::QuantitySelected
unsigned int QuantitySelected()
Definition: coincontrol.h:79
uint256
256-bit unsigned big integer.
Definition: uint256.h:38
CNoDestination
Definition: standard.h:68
CTxDestination
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:81
CCoinControl::txPriv
CKey txPriv
Definition: coincontrol.h:20
CCoinControl::fSplitBlock
bool fSplitBlock
Definition: coincontrol.h:22
CCoinControl::nMinimumTotalFee
CAmount nMinimumTotalFee
Minimum absolute fee (not per kilobyte)
Definition: coincontrol.h:29
CPubKey
An encapsulated public key.
Definition: pubkey.h:37
CKey
An encapsulated private key.
Definition: key.h:39
CCoinControl::nSplitBlock
int nSplitBlock
Definition: coincontrol.h:23
CCoinControl::useSwiftTX
bool useSwiftTX
Definition: coincontrol.h:21
CCoinControl::SetNull
void SetNull()
Definition: coincontrol.h:36
COutPoint
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:36
CCoinControl::UnSelect
void UnSelect(const COutPoint &output)
Definition: coincontrol.h:64
CCoinControl::destChange
CTxDestination destChange
Definition: coincontrol.h:18