Bitcoin Core  21.99.0
P2P Digital Currency
spend.h
Go to the documentation of this file.
1 // Copyright (c) 2021 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_SPEND_H
6 #define BITCOIN_WALLET_SPEND_H
7 
8 #include <wallet/coinselection.h>
9 #include <wallet/transaction.h>
10 #include <wallet/wallet.h>
11 
12 class COutput
13 {
14 public:
15  const CWalletTx *tx;
16 
18  int i;
19 
25  int nDepth;
26 
29 
31  bool fSpendable;
32 
34  bool fSolvable;
35 
38 
44  bool fSafe;
45 
46  COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn, bool use_max_sig_in = false)
47  {
48  tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn; fSolvable = fSolvableIn; fSafe = fSafeIn; nInputBytes = -1; use_max_sig = use_max_sig_in;
49  // If known and signable by the given wallet, compute nInputBytes
50  // Failure will keep this value -1
51  if (fSpendable && tx) {
53  }
54  }
55 
56  std::string ToString() const;
57 
58  inline CInputCoin GetInputCoin() const
59  {
60  return CInputCoin(tx->tx, i, nInputBytes);
61  }
62 };
63 
64 #endif // BITCOIN_WALLET_SPEND_H
COutput::use_max_sig
bool use_max_sig
Whether to use the maximum sized, 72 byte signature when calculating the size of the input spend.
Definition: spend.h:37
wallet.h
COutput::COutput
COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn, bool use_max_sig_in=false)
Definition: spend.h:46
COutput::nInputBytes
int nInputBytes
Pre-computed estimated size of this output as a fully-signed input in a transaction.
Definition: spend.h:28
CWalletTx::GetSpendSize
int GetSpendSize(unsigned int out, bool use_max_sig=false) const
Get the marginal bytes if spending the specified output from this transaction.
Definition: transaction.h:280
COutput::fSolvable
bool fSolvable
Whether we know how to spend this output, ignoring the lack of keys.
Definition: spend.h:34
COutput::GetInputCoin
CInputCoin GetInputCoin() const
Definition: spend.h:58
coinselection.h
CWalletTx::tx
CTransactionRef tx
Definition: transaction.h:164
COutput::ToString
std::string ToString() const
Definition: spend.cpp:24
COutput::fSpendable
bool fSpendable
Whether we have the private keys to spend this output.
Definition: spend.h:31
COutput::fSafe
bool fSafe
Whether this output is considered safe to spend.
Definition: spend.h:44
COutput::nDepth
int nDepth
Depth in block chain.
Definition: spend.h:25
CInputCoin
A UTXO under consideration for use in funding a new transaction.
Definition: coinselection.h:19
transaction.h
COutput::tx
const CWalletTx * tx
Definition: spend.h:15
CWalletTx
A transaction with a bunch of additional info that only the owner cares about.
Definition: transaction.h:68
COutput::i
int i
Index in tx->vout.
Definition: spend.h:18
COutput
Definition: spend.h:12