5#ifndef BITCOIN_WALLET_SPEND_H
6#define BITCOIN_WALLET_SPEND_H
50 COutput(
const CWallet&
wallet,
const CWalletTx& wtx,
int iIn,
int nDepthIn,
bool fSpendableIn,
bool fSolvableIn,
bool fSafeIn,
bool use_max_sig_in =
false)
static constexpr CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
int64_t CAmount
Amount in satoshis (Can be negative)
int nDepth
Depth in block chain.
bool fSafe
Whether this output is considered safe to spend.
bool fSolvable
Whether we know how to spend this output, ignoring the lack of keys.
int nInputBytes
Pre-computed estimated size of this output as a fully-signed input in a transaction.
bool fSpendable
Whether we have the private keys to spend this output.
CInputCoin GetInputCoin() const
std::string ToString() const
bool use_max_sig
Whether to use the maximum sized, 72 byte signature when calculating the size of the input spend.
COutput(const CWallet &wallet, const CWalletTx &wtx, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn, bool use_max_sig_in=false)
The basic transaction that is broadcasted on the network and contained in blocks.
An output of a transaction.
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
A transaction with a bunch of additional info that only the owner cares about.
An interface to be implemented by keystores that support signing.
std::shared_ptr< const CTransaction > CTransactionRef
CAmount GetAvailableBalance(const CWallet &wallet, const CCoinControl *coinControl=nullptr)
std::map< CTxDestination, std::vector< COutput > > ListCoins(const CWallet &wallet) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Return list of available coins and locked coins grouped by non-change output address.
std::vector< OutputGroup > GroupOutputs(const CWallet &wallet, const std::vector< COutput > &outputs, const CoinSelectionParams &coin_sel_params, const CoinEligibilityFilter &filter, bool positive_only)
const CTxOut & FindNonChangeParentOutput(const CWallet &wallet, const CTransaction &tx, int output) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Find non-change parent output.
void AvailableCoins(const CWallet &wallet, std::vector< COutput > &vCoins, const CCoinControl *coinControl=nullptr, const CAmount &nMinimumAmount=1, const CAmount &nMaximumAmount=MAX_MONEY, const CAmount &nMinimumSumAmount=MAX_MONEY, const uint64_t nMaximumCount=0) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
populate vCoins with vector of available COutputs.
bool CreateTransaction(CWallet &wallet, const std::vector< CRecipient > &vecSend, CTransactionRef &tx, CAmount &nFeeRet, int &nChangePosInOut, bilingual_str &error, const CCoinControl &coin_control, FeeCalculation &fee_calc_out, bool sign=true)
Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also cr...
bool FundTransaction(CWallet &wallet, CMutableTransaction &tx, CAmount &nFeeRet, int &nChangePosInOut, bilingual_str &error, bool lockUnspents, const std::set< int > &setSubtractFeeFromOutputs, CCoinControl)
Insert additional inputs into the transaction by calling CreateTransaction();.
bool SelectCoins(const CWallet &wallet, const std::vector< COutput > &vAvailableCoins, const CAmount &nTargetValue, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, const CCoinControl &coin_control, CoinSelectionParams &coin_selection_params) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Select a set of coins such that nValueRet >= nTargetValue and at least all coins from coin_control ar...
int CalculateMaximumSignedInputSize(const CTxOut &txout, const CWallet *pwallet, bool use_max_sig=false)
TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector< CTxOut > &txouts, const CCoinControl *coin_control=nullptr)
Calculate the size of the transaction assuming all signatures are max size Use DummySignatureCreator,...
int GetTxSpendSize(const CWallet &wallet, const CWalletTx &wtx, unsigned int out, bool use_max_sig=false)
Get the marginal bytes if spending the specified output from this transaction.
bool AttemptSelection(const CWallet &wallet, const CAmount &nTargetValue, const CoinEligibilityFilter &eligibility_filter, std::vector< COutput > coins, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, const CoinSelectionParams &coin_selection_params)
Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is st...
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
A mutable version of CTransaction.
Parameters for filtering which OutputGroups we may use in coin selection.
Parameters for one iteration of Coin Selection.
A group of UTXOs paid to the same output script.
bool error(const char *fmt, const Args &... args)
#define EXCLUSIVE_LOCKS_REQUIRED(...)