Bitcoin ABC 0.26.3
P2P Digital Currency
|
#include <wallet/spend.h>
#include <common/args.h>
#include <common/system.h>
#include <consensus/validation.h>
#include <interfaces/chain.h>
#include <policy/policy.h>
#include <util/check.h>
#include <util/insert.h>
#include <util/moneystr.h>
#include <util/translation.h>
#include <wallet/coincontrol.h>
#include <wallet/fees.h>
#include <wallet/receive.h>
#include <wallet/transaction.h>
#include <wallet/wallet.h>
Go to the source code of this file.
Functions | |
int | GetTxSpendSize (const CWallet &wallet, const CWalletTx &wtx, unsigned int out, bool use_max_sig) |
Get the marginal bytes if spending the specified output from this transaction. | |
int | CalculateMaximumSignedInputSize (const CTxOut &txout, const CWallet *wallet, bool use_max_sig) |
Get the marginal bytes of spending the specified output. | |
int64_t | CalculateMaximumSignedTxSize (const CTransaction &tx, const CWallet *wallet, const std::vector< CTxOut > &txouts, bool use_max_sig) |
Calculate the size of the transaction assuming all signatures are max size Use DummySignatureCreator, which inserts 71 byte signatures everywhere. | |
int64_t | CalculateMaximumSignedTxSize (const CTransaction &tx, const CWallet *wallet, bool use_max_sig) |
void | AvailableCoins (const CWallet &wallet, std::vector< COutput > &vCoins, const CCoinControl *coinControl, const Amount nMinimumAmount, const Amount nMaximumAmount, const Amount nMinimumSumAmount, const uint64_t nMaximumCount) |
populate vCoins with vector of available COutputs. | |
Amount | GetAvailableBalance (const CWallet &wallet, const CCoinControl *coinControl) |
const CTxOut & | FindNonChangeParentOutput (const CWallet &wallet, const CTransaction &tx, int output) |
Find non-change parent output. | |
std::map< CTxDestination, std::vector< COutput > > | ListCoins (const CWallet &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, bool separate_coins, const CFeeRate &effective_feerate, const CFeeRate &long_term_feerate, const CoinEligibilityFilter &filter, bool positive_only) |
bool | SelectCoinsMinConf (const CWallet &wallet, const Amount nTargetValue, const CoinEligibilityFilter &eligibility_filter, std::vector< COutput > coins, std::set< CInputCoin > &setCoinsRet, Amount &nValueRet, const CoinSelectionParams &coin_selection_params, bool &bnb_used) |
Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is stochastic for some inputs and upon completion the coin set and corresponding actual target value is assembled param@[in] groups Set of UTXOs to consider. | |
bool | SelectCoins (const CWallet &wallet, const std::vector< COutput > &vAvailableCoins, const Amount nTargetValue, std::set< CInputCoin > &setCoinsRet, Amount &nValueRet, const CCoinControl &coin_control, CoinSelectionParams &coin_selection_params, bool &bnb_used) |
Select a set of coins such that nValueRet >= nTargetValue and at least all coins from coin_control are selected; never select unconfirmed coins if they are not ours param@[out] setCoinsRet Populated with inputs including pre-selected inputs from coin_control and Coin Selection if successful. | |
static bool | CreateTransactionInternal (CWallet &wallet, const std::vector< CRecipient > &vecSend, CTransactionRef &tx, Amount &nFeeRet, int &nChangePosInOut, bilingual_str &error, const CCoinControl &coin_control, bool sign) |
bool | CreateTransaction (CWallet &wallet, const std::vector< CRecipient > &vecSend, CTransactionRef &tx, Amount &nFeeRet, int &nChangePosInOut, bilingual_str &error, const CCoinControl &coin_control, bool sign) |
Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also create the change output, when needed. | |
bool | FundTransaction (CWallet &wallet, CMutableTransaction &tx, Amount &nFeeRet, int &nChangePosInOut, bilingual_str &error, bool lockUnspents, const std::set< int > &setSubtractFeeFromOutputs, CCoinControl coinControl) |
Insert additional inputs into the transaction by calling CreateTransaction();. | |
Variables | |
static const size_t | OUTPUT_GROUP_MAX_ENTRIES = 10 |
void AvailableCoins | ( | const CWallet & | wallet, |
std::vector< COutput > & | vCoins, | ||
const CCoinControl * | coinControl, | ||
const Amount | nMinimumAmount, | ||
const Amount | nMaximumAmount, | ||
const Amount | nMinimumSumAmount, | ||
const uint64_t | nMaximumCount | ||
) |
int64_t CalculateMaximumSignedTxSize | ( | const CTransaction & | tx, |
const CWallet * | wallet, | ||
bool | use_max_sig | ||
) |
int64_t CalculateMaximumSignedTxSize | ( | const CTransaction & | tx, |
const CWallet * | wallet, | ||
const std::vector< CTxOut > & | txouts, | ||
bool | use_max_sig = false |
||
) |
Calculate the size of the transaction assuming all signatures are max size Use DummySignatureCreator, which inserts 71 byte signatures everywhere.
NOTE: this requires that all inputs must be in mapWallet (eg the tx should be AllInputsMine).
Definition at line 47 of file spend.cpp.
bool CreateTransaction | ( | CWallet & | wallet, |
const std::vector< CRecipient > & | vecSend, | ||
CTransactionRef & | tx, | ||
Amount & | nFeeRet, | ||
int & | nChangePosInOut, | ||
bilingual_str & | error, | ||
const CCoinControl & | coin_control, | ||
bool | sign = true |
||
) |
Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also create the change output, when needed.
Definition at line 993 of file spend.cpp.
|
static |
const CTxOut & FindNonChangeParentOutput | ( | const CWallet & | wallet, |
const CTransaction & | tx, | ||
int | output | ||
) |
bool FundTransaction | ( | CWallet & | wallet, |
CMutableTransaction & | tx, | ||
Amount & | nFeeRet, | ||
int & | nChangePosInOut, | ||
bilingual_str & | error, | ||
bool | lockUnspents, | ||
const std::set< int > & | setSubtractFeeFromOutputs, | ||
CCoinControl | coinControl | ||
) |
Insert additional inputs into the transaction by calling CreateTransaction();.
Definition at line 1032 of file spend.cpp.
Amount GetAvailableBalance | ( | const CWallet & | wallet, |
const CCoinControl * | coinControl | ||
) |
std::vector< OutputGroup > GroupOutputs | ( | const CWallet & | wallet, |
const std::vector< COutput > & | outputs, | ||
bool | separate_coins, | ||
const CFeeRate & | effective_feerate, | ||
const CFeeRate & | long_term_feerate, | ||
const CoinEligibilityFilter & | filter, | ||
bool | positive_only | ||
) |
std::map< CTxDestination, std::vector< COutput > > ListCoins | ( | const CWallet & | wallet | ) |
bool SelectCoins | ( | const CWallet & | wallet, |
const std::vector< COutput > & | vAvailableCoins, | ||
const Amount | nTargetValue, | ||
std::set< CInputCoin > & | setCoinsRet, | ||
Amount & | nValueRet, | ||
const CCoinControl & | coin_control, | ||
CoinSelectionParams & | coin_selection_params, | ||
bool & | bnb_used | ||
) |
Select a set of coins such that nValueRet >= nTargetValue and at least all coins from coin_control are selected; never select unconfirmed coins if they are not ours param@[out] setCoinsRet Populated with inputs including pre-selected inputs from coin_control and Coin Selection if successful.
param@[out] nValueRet Total value of selected coins including pre-selected ones from coin_control and Coin Selection if successful.
Definition at line 474 of file spend.cpp.
bool SelectCoinsMinConf | ( | const CWallet & | wallet, |
const Amount | nTargetValue, | ||
const CoinEligibilityFilter & | eligibility_filter, | ||
std::vector< COutput > | coins, | ||
std::set< CInputCoin > & | setCoinsRet, | ||
Amount & | nValueRet, | ||
const CoinSelectionParams & | coin_selection_params, | ||
bool & | bnb_used | ||
) |
Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is stochastic for some inputs and upon completion the coin set and corresponding actual target value is assembled param@[in] groups Set of UTXOs to consider.
These will be categorized into OutputGroups and filtered using eligibility_filter before selecting coins. param@[out] setCoinsRet Populated with the coins selected if successful. param@[out] nValueRet Used to return the total value of selected coins.
Definition at line 422 of file spend.cpp.