48 const std::unique_ptr<SigningProvider> provider =
wallet->GetSolvingProvider(txout.
scriptPubKey);
56 if (!
wallet->DummySignTx(txNew, txouts, coin_control)) {
62 return TxSize{vsize, weight};
67 std::vector<CTxOut> txouts;
72 if (mi !=
wallet->mapWallet.end()) {
74 txouts.emplace_back(mi->second.tx->vout.at(input.
prevout.
n));
75 }
else if (coin_control) {
80 txouts.emplace_back(txout);
101 std::set<uint256> trusted_parents;
102 for (
const auto& entry :
wallet.mapWallet)
104 const uint256& wtxid = entry.first;
107 if (!
wallet.chain().checkFinalTx(*wtx.
tx)) {
111 if (
wallet.IsTxImmatureCoinBase(wtx))
114 int nDepth =
wallet.GetTxDepthInMainChain(wtx);
140 if (nDepth == 0 && wtx.
mapValue.count(
"replaces_txid")) {
152 if (nDepth == 0 && wtx.
mapValue.count(
"replaced_by_txid")) {
156 if (only_safe && !safeTx) {
160 if (nDepth < min_depth || nDepth > max_depth) {
164 for (
unsigned int i = 0; i < wtx.
tx->vout.size(); i++) {
170 if (wtx.
tx->vout[i].nValue < nMinimumAmount || wtx.
tx->vout[i].nValue > nMaximumAmount)
176 if (
wallet.IsLockedCoin(entry.first, i))
179 if (
wallet.IsSpent(wtxid, i))
188 if (!allow_used_addresses &&
wallet.IsSpentKey(wtxid, i)) {
192 std::unique_ptr<SigningProvider> provider =
wallet.GetSolvingProvider(wtx.
tx->vout[i].scriptPubKey);
194 bool solvable = provider ?
IsSolvable(*provider, wtx.
tx->vout[i].scriptPubKey) :
false;
201 nTotal += wtx.
tx->vout[i].nValue;
203 if (nTotal >= nMinimumSumAmount) {
209 if (nMaximumCount > 0 && vCoins.size() >= nMaximumCount) {
221 std::vector<COutput> vCoins;
223 for (
const COutput& out : vCoins) {
224 if (out.fSpendable) {
225 balance += out.tx->tx->vout[out.i].nValue;
238 auto it =
wallet.mapWallet.find(prevout.
hash);
239 if (it ==
wallet.mapWallet.end() || it->second.tx->vout.size() <= prevout.
n ||
240 !
wallet.IsMine(it->second.tx->vout[prevout.
n])) {
243 ptx = it->second.tx.get();
253 std::map<CTxDestination, std::vector<COutput>> result;
254 std::vector<COutput> availableCoins;
258 for (
const COutput& coin : availableCoins) {
262 result[address].emplace_back(std::move(coin));
266 std::vector<COutPoint> lockedCoins;
267 wallet.ListLockedCoins(lockedCoins);
271 for (
const COutPoint& output : lockedCoins) {
272 auto it =
wallet.mapWallet.find(output.hash);
273 if (it !=
wallet.mapWallet.end()) {
274 int depth =
wallet.GetTxDepthInMainChain(it->second);
275 if (depth >= 0 && output.n < it->second.tx->vout.size() &&
276 wallet.IsMine(it->second.tx->vout[output.n]) == is_mine_filter
280 result[address].emplace_back(
281 wallet, it->second, output.n, depth,
true ,
true ,
false );
292 std::vector<OutputGroup> groups_out;
296 for (
const COutput& output : outputs) {
298 if (!output.fSpendable)
continue;
300 size_t ancestors, descendants;
301 wallet.chain().getTransactionAncestry(output.tx->GetHash(), ancestors, descendants);
302 CInputCoin input_coin = output.GetInputCoin();
309 if (positive_only && group.GetSelectionAmount() <= 0)
continue;
310 if (group.m_outputs.size() > 0 && group.EligibleForSpending(filter)) groups_out.push_back(group);
321 std::map<CScript, std::vector<OutputGroup>> spk_to_groups_map;
322 for (
const auto& output : outputs) {
324 if (!output.fSpendable)
continue;
326 size_t ancestors, descendants;
327 wallet.chain().getTransactionAncestry(output.tx->GetHash(), ancestors, descendants);
328 CInputCoin input_coin = output.GetInputCoin();
331 std::vector<OutputGroup>& groups = spk_to_groups_map[spk];
333 if (groups.size() == 0) {
346 groups.emplace_back(coin_sel_params);
347 group = &groups.back();
355 for (
const auto& spk_and_groups_pair: spk_to_groups_map) {
356 const std::vector<OutputGroup>& groups_per_spk= spk_and_groups_pair.second;
359 for (
auto group_it = groups_per_spk.rbegin(); group_it != groups_per_spk.rend(); group_it++) {
384 std::vector<std::tuple<CAmount, std::set<CInputCoin>,
CAmount>> results;
387 std::vector<OutputGroup> positive_groups =
GroupOutputs(
wallet, coins, coin_selection_params, eligibility_filter,
true );
388 std::set<CInputCoin> bnb_coins;
392 results.emplace_back(std::make_tuple(waste, std::move(bnb_coins), bnb_value));
396 std::vector<OutputGroup> all_groups =
GroupOutputs(
wallet, coins, coin_selection_params, eligibility_filter,
false );
399 std::set<CInputCoin> knapsack_coins;
403 results.emplace_back(std::make_tuple(waste, std::move(knapsack_coins), knapsack_value));
410 if (srd_result != std::nullopt) {
412 results.emplace_back(std::make_tuple(waste, std::move(srd_result->first), srd_result->second));
415 if (results.size() == 0) {
422 const auto& best_result = std::min_element(results.begin(), results.end(), [](
const auto& a,
const auto& b) {
423 return std::get<0>(a) < std::get<0>(b) || (std::get<0>(a) == std::get<0>(b) && std::get<1>(a).size() > std::get<1>(b).size());
425 setCoinsRet = std::get<1>(*best_result);
426 nValueRet = std::get<2>(*best_result);
432 std::vector<COutput> vCoins(vAvailableCoins);
433 CAmount value_to_select = nTargetValue;
438 for (
const COutput& out : vCoins)
442 nValueRet += out.tx->tx->vout[out.i].nValue;
443 setCoinsRet.insert(out.GetInputCoin());
445 return (nValueRet >= nTargetValue);
449 std::set<CInputCoin> setPresetCoins;
450 CAmount nValueFromPresetInputs = 0;
452 std::vector<COutPoint> vPresetInputs;
454 for (
const COutPoint& outpoint : vPresetInputs) {
455 int input_bytes = -1;
457 std::map<uint256, CWalletTx>::const_iterator it =
wallet.mapWallet.find(outpoint.hash);
458 if (it !=
wallet.mapWallet.end()) {
461 if (wtx.
tx->vout.size() <= outpoint.n) {
465 txout = wtx.
tx->vout.at(outpoint.n);
467 if (input_bytes == -1) {
476 CInputCoin coin(outpoint, txout, input_bytes);
487 setPresetCoins.insert(coin);
491 for (std::vector<COutput>::iterator it = vCoins.begin(); it != vCoins.end() && coin_control.
HasSelected();)
493 if (setPresetCoins.count(it->GetInputCoin()))
494 it = vCoins.erase(it);
499 unsigned int limit_ancestor_count = 0;
500 unsigned int limit_descendant_count = 0;
501 wallet.chain().getPackageLimits(limit_ancestor_count, limit_descendant_count);
502 const size_t max_ancestors = (size_t)std::max<int64_t>(1, limit_ancestor_count);
503 const size_t max_descendants = (size_t)std::max<int64_t>(1, limit_descendant_count);
518 const bool res = [&] {
520 if (value_to_select <= 0)
return true;
529 if (
wallet.m_spend_zero_conf_change) {
532 vCoins, setCoinsRet, nValueRet, coin_selection_params)) {
536 vCoins, setCoinsRet, nValueRet, coin_selection_params)) {
543 vCoins, setCoinsRet, nValueRet, coin_selection_params)) {
551 vCoins, setCoinsRet, nValueRet, coin_selection_params)) {
558 CoinEligibilityFilter(0, 1, std::numeric_limits<uint64_t>::max(), std::numeric_limits<uint64_t>::max(),
true ),
559 vCoins, setCoinsRet, nValueRet, coin_selection_params)) {
571 nValueRet += nValueFromPresetInputs;
581 constexpr int64_t MAX_ANTI_FEE_SNIPING_TIP_AGE = 8 * 60 * 60;
584 if (block_time < (
GetTime() - MAX_ANTI_FEE_SNIPING_TIP_AGE)) {
618 locktime = block_height;
625 locktime = std::max(0, (
int)locktime -
GetRandInt(100));
638 const std::vector<CRecipient>& vecSend,
641 int& nChangePosInOut,
659 const OutputType change_type =
wallet.TransactionChangeType(coin_control.m_change_type ? *coin_control.m_change_type :
wallet.m_default_change_type, vecSend);
661 unsigned int outputs_to_subtract_fee_from = 0;
662 for (
const auto& recipient : vecSend) {
663 recipients_sum += recipient.nAmount;
665 if (recipient.fSubtractFeeFromAmount) {
666 outputs_to_subtract_fee_from++;
677 if (!std::get_if<CNoDestination>(&coin_control.destChange)) {
692 error =
_(
"Transaction needs a change address, but we can't generate it.") +
Untranslated(
" ") + dest_err;
700 CTxOut change_prototype_txout(0, scriptChange);
707 if (change_spend_size == -1) {
721 if (coin_control.m_feerate && coin_selection_params.
m_effective_feerate > *coin_control.m_feerate) {
727 error =
_(
"Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.");
743 for (
const auto& recipient : vecSend)
745 CTxOut txout(recipient.nAmount, recipient.scriptPubKey);
754 error =
_(
"Transaction amount too small");
757 txNew.
vout.push_back(txout);
762 CAmount selection_target = recipients_sum + not_input_fees;
765 std::vector<COutput> vAvailableCoins;
770 std::set<CInputCoin> setCoins;
771 if (!
SelectCoins(
wallet, vAvailableCoins, selection_target, setCoins, inputs_sum, coin_control, coin_selection_params))
773 error =
_(
"Insufficient funds");
779 const CAmount change_and_fee = inputs_sum - recipients_sum;
780 assert(change_and_fee >= 0);
781 CTxOut newTxOut(change_and_fee, scriptChange);
783 if (nChangePosInOut == -1)
788 else if ((
unsigned int)nChangePosInOut > txNew.
vout.size())
790 error =
_(
"Change index out of range");
794 assert(nChangePosInOut != -1);
795 auto change_position = txNew.
vout.insert(txNew.
vout.begin() + nChangePosInOut, newTxOut);
798 std::vector<CInputCoin> selected_coins(setCoins.begin(), setCoins.end());
810 for (
const auto& coin : selected_coins) {
816 int nBytes = tx_sizes.
vsize;
818 error =
_(
"Missing solving data for estimating transaction size");
826 change_position->nValue -= fee_needed;
832 CAmount change_amount = change_position->nValue;
835 nChangePosInOut = -1;
837 txNew.
vout.erase(change_position);
841 nBytes = tx_sizes.
vsize;
850 if (fee_needed <= change_and_fee - change_amount) {
851 nFeeRet = change_and_fee - change_amount;
856 CAmount to_reduce = fee_needed + change_amount - change_and_fee;
859 for (
const auto& recipient : vecSend)
861 if (i == nChangePosInOut) {
866 if (recipient.fSubtractFeeFromAmount)
868 txout.
nValue -= to_reduce / outputs_to_subtract_fee_from;
873 txout.
nValue -= to_reduce % outputs_to_subtract_fee_from;
879 error =
_(
"The transaction amount is too small to pay the fee");
881 error =
_(
"The transaction amount is too small to send after the fee has been deducted");
888 nFeeRet = fee_needed;
892 if (scriptChange.
empty() && nChangePosInOut != -1) {
896 if (sign && !
wallet.SignTransaction(txNew)) {
897 error =
_(
"Signing transaction failed");
908 error =
_(
"Transaction too large");
912 if (nFeeRet >
wallet.m_default_max_tx_fee) {
919 if (!
wallet.chain().checkChainLimits(tx)) {
920 error =
_(
"Transaction has too long of a mempool chain");
928 fee_calc_out = feeCalc;
930 wallet.WalletLogPrintf(
"Fee Calculation: Fee:%d Bytes:%u Tgt:%d (requested %d) Reason:\"%s\" Decay %.5f: Estimation: (%g - %g) %.2f%% %.1f/(%.1f %d mem %.1f out) Fail: (%g - %g) %.2f%% %.1f/(%.1f %d mem %.1f out)\n",
943 const std::vector<CRecipient>& vecSend,
946 int& nChangePosInOut,
952 if (vecSend.empty()) {
953 error =
_(
"Transaction must have at least one recipient");
957 if (std::any_of(vecSend.cbegin(), vecSend.cend(), [](
const auto& recipient){ return recipient.nAmount < 0; })) {
958 error =
_(
"Transaction amounts must not be negative");
964 int nChangePosIn = nChangePosInOut;
973 int nChangePosInOut2 = nChangePosIn;
977 const bool use_aps = nFeeRet2 <= nFeeRet +
wallet.m_max_aps_fee;
978 wallet.WalletLogPrintf(
"Fee non-grouped = %lld, grouped = %lld, using %s\n", nFeeRet, nFeeRet2, use_aps ?
"grouped" :
"non-grouped");
982 nChangePosInOut = nChangePosInOut2;
991 std::vector<CRecipient> vecSend;
994 for (
size_t idx = 0; idx < tx.
vout.size(); idx++) {
997 vecSend.push_back(recipient);
1016 if (nChangePosInOut != -1) {
1017 tx.
vout.insert(tx.
vout.begin() + nChangePosInOut, tx_new->vout[nChangePosInOut]);
1022 for (
unsigned int idx = 0; idx < tx.
vout.size(); idx++) {
1023 tx.
vout[idx].nValue = tx_new->vout[idx].nValue;
1027 for (
const CTxIn& txin : tx_new->vin) {
1029 tx.
vin.push_back(txin);
static constexpr CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
int64_t CAmount
Amount in satoshis (Can be negative)
#define CHECK_NONFATAL(condition)
Throw a NonFatalCheckError when the condition evaluates to false.
#define Assert(val)
Identity function.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
bool GetExternalOutput(const COutPoint &outpoint, CTxOut &txout) const
bool IsSelected(const COutPoint &output) const
int m_max_depth
Maximum chain depth value for coin availability.
void Select(const COutPoint &output)
bool fAllowWatchOnly
Includes watch only addresses which are solvable.
int m_min_depth
Minimum chain depth value for coin availability.
FlatSigningProvider m_external_provider
SigningProvider that has pubkeys and scripts to do spend size estimation for external inputs.
bool m_add_inputs
If false, only selected inputs are used.
bool m_avoid_address_reuse
Forbids inclusion of dirty (previously used) addresses.
bool m_include_unsafe_inputs
If false, only safe inputs will be used.
bool m_avoid_partial_spends
Avoid partial use of funds sent to a given address.
bool fAllowOtherInputs
If false, allows unselected inputs, but requires all selected inputs be used.
void ListSelected(std::vector< COutPoint > &vOutpoints) const
std::string ToString(const FeeEstimateMode &fee_estimate_mode=FeeEstimateMode::BTC_KVB) const
CAmount GetFee(uint32_t num_bytes) const
Return the fee in satoshis for the given size in bytes.
An outpoint - a combination of a transaction hash and an index n into its vout.
int nDepth
Depth in block chain.
std::string ToString() const
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
const std::vector< CTxOut > vout
const std::vector< CTxIn > vin
An input of a transaction.
static const uint32_t SEQUENCE_FINAL
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.
mapValue_t mapValue
Key/value map with information about the transaction.
const uint256 & GetHash() const
A wrapper to reserve an address from a wallet.
An interface to be implemented by keystores that support signing.
std::string ToString() const
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
virtual bool isInitialBlockDownload()=0
Check if in IBD.
virtual bool findBlock(const uint256 &hash, const FoundBlock &block={})=0
Return whether node has the block and optionally return block metadata or contents.
Helper for findBlock to selectively return pieces of block data.
void emplace_back(Args &&... args)
const int DEFAULT_MAX_DEPTH
const int DEFAULT_MIN_DEPTH
bool KnapsackSolver(const CAmount &nTargetValue, std::vector< OutputGroup > &groups, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet)
std::optional< std::pair< std::set< CInputCoin >, CAmount > > SelectCoinsSRD(const std::vector< OutputGroup > &utxo_pool, CAmount target_value)
Select coins by Single Random Draw.
bool SelectCoinsBnB(std::vector< OutputGroup > &utxo_pool, const CAmount &selection_target, const CAmount &cost_of_change, std::set< CInputCoin > &out_set, CAmount &value_ret)
CAmount GetSelectionWaste(const std::set< CInputCoin > &inputs, CAmount change_cost, CAmount target, bool use_effective_value)
Compute the waste for this result given the cost of change and the opportunity cost of spending these...
static const CAmount MIN_FINAL_CHANGE
final minimum change amount after paying for fees
static int64_t GetTransactionWeight(const CTransaction &tx)
bilingual_str TransactionErrorString(const TransactionError err)
@ SAT_VB
Use sat/vB fee rate unit.
void KeepDestination()
Keep the address. Do not return it's key to the keypool when this object goes out of scope.
bool GetReservedDestination(CTxDestination &pubkey, bool internal, bilingual_str &error)
Reserve an address.
bool DummySignInput(const SigningProvider &provider, CTxIn &tx_in, const CTxOut &txout, bool use_max_sig)
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
std::string FormatMoney(const CAmount n)
Money parsing/formatting utilities.
void insert(Tdst &dst, const Tsrc &src)
Simplification of std insertion.
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
int64_t GetVirtualTransactionInputSize(const CTxIn &txin, int64_t nSigOpCost, unsigned int bytes_per_sigop)
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
static const unsigned int MAX_STANDARD_TX_WEIGHT
The maximum weight for transactions we're willing to relay/mine.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
int GetRandInt(int nMax) noexcept
void Shuffle(I first, I last, R &&rng)
More efficient than using std::shuffle on a FastRandomContext.
bool CachedTxIsFromMe(const CWallet &wallet, const CWalletTx &wtx, const isminefilter &filter)
bool OutputIsChange(const CWallet &wallet, const CTxOut &txout)
bool CachedTxIsTrusted(const CWallet &wallet, const CWalletTx &wtx, std::set< uint256 > &trusted_parents)
static const unsigned int LOCKTIME_THRESHOLD
size_t GetSerializeSize(const T &t, int nVersion=0)
bool IsSolvable(const SigningProvider &provider, const CScript &script)
static bool IsCurrentForAntiFeeSniping(interfaces::Chain &chain, const uint256 &block_hash)
int CalculateMaximumSignedInputSize(const CTxOut &txout, const SigningProvider *provider, bool use_max_sig)
std::vector< OutputGroup > GroupOutputs(const CWallet &wallet, const std::vector< COutput > &outputs, const CoinSelectionParams &coin_sel_params, const CoinEligibilityFilter &filter, bool positive_only)
static uint32_t GetLocktimeForNewTransaction(interfaces::Chain &chain, const uint256 &block_hash, int block_height)
Return a height-based locktime for new transactions (uses the height of the current chain tip unless ...
bool FundTransaction(CWallet &wallet, CMutableTransaction &tx, CAmount &nFeeRet, int &nChangePosInOut, bilingual_str &error, bool lockUnspents, const std::set< int > &setSubtractFeeFromOutputs, CCoinControl coinControl)
Insert additional inputs into the transaction by calling CreateTransaction();.
std::map< CTxDestination, std::vector< COutput > > ListCoins(const CWallet &wallet)
Return list of available coins and locked coins grouped by non-change output address.
void AvailableCoins(const CWallet &wallet, std::vector< COutput > &vCoins, const CCoinControl *coinControl, const CAmount &nMinimumAmount, const CAmount &nMaximumAmount, const CAmount &nMinimumSumAmount, const uint64_t nMaximumCount)
populate vCoins with vector of available COutputs.
CAmount GetAvailableBalance(const CWallet &wallet, const CCoinControl *coinControl)
const CTxOut & FindNonChangeParentOutput(const CWallet &wallet, const CTransaction &tx, int output)
Find non-change parent output.
TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector< CTxOut > &txouts, const CCoinControl *coin_control)
Calculate the size of the transaction assuming all signatures are max size Use DummySignatureCreator,...
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)
Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also cr...
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)
Select a set of coins such that nValueRet >= nTargetValue and at least all coins from coin_control ar...
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...
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.
static constexpr size_t OUTPUT_GROUP_MAX_ENTRIES
static bool CreateTransactionInternal(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) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
A mutable version of CTransaction.
std::vector< CTxOut > vout
Parameters for filtering which OutputGroups we may use in coin selection.
const bool m_include_partial_groups
When avoid_reuse=true and there are full groups (OUTPUT_GROUP_MAX_ENTRIES), whether or not to use any...
Parameters for one iteration of Coin Selection.
bool m_subtract_fee_outputs
Indicate that we are subtracting the fee from outputs.
CFeeRate m_discard_feerate
If the cost to spend a change output at the discard feerate exceeds its value, drop it to fees.
CAmount m_cost_of_change
Cost of creating the change output + cost of spending the change output in the future.
size_t change_spend_size
Size of the input to spend a change output in virtual bytes.
size_t tx_noinputs_size
Size of the transaction before coin selection, consisting of the header and recipient output(s),...
CFeeRate m_effective_feerate
The targeted feerate of the transaction being built.
bool m_avoid_partial_spends
When true, always spend all (up to OUTPUT_GROUP_MAX_ENTRIES) or none of the outputs associated with t...
size_t change_output_size
Size of a change output in bytes, determined by the output type.
CAmount m_change_fee
Cost of creating the change output.
CFeeRate m_long_term_feerate
The feerate estimate used to estimate an upper bound on what should be sufficient to spend the change...
A group of UTXOs paid to the same output script.
std::vector< CInputCoin > m_outputs
The list of UTXOs contained in this output group.
CAmount GetSelectionAmount() const
void Insert(const CInputCoin &output, int depth, bool from_me, size_t ancestors, size_t descendants, bool positive_only)
bool EligibleForSpending(const CoinEligibilityFilter &eligibility_filter) const
bool error(const char *fmt, const Args &... args)
static secp256k1_context * ctx
#define EXCLUSIVE_LOCKS_REQUIRED(...)
int64_t GetTime()
DEPRECATED Use either GetTimeSeconds (not mockable) or GetTime<T> (mockable)
bilingual_str _(const char *psz)
Translation function.
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
std::string StringForFeeReason(FeeReason reason)
static constexpr uint32_t MAX_BIP125_RBF_SEQUENCE
static const int PROTOCOL_VERSION
network protocol versioning
CFeeRate GetMinimumFeeRate(const CWallet &wallet, const CCoinControl &coin_control, FeeCalculation *feeCalc)
Estimate the minimum fee rate considering user set parameters and the required fee.
CFeeRate GetDiscardRate(const CWallet &wallet)
Return the maximum feerate for discarding change.
static constexpr size_t DUMMY_NESTED_P2WPKH_INPUT_SIZE
Pre-calculated constants for input size estimation in virtual size
static const bool DEFAULT_WALLET_REJECT_LONG_CHAINS
Default for -walletrejectlongchains.
@ WALLET_FLAG_DISABLE_PRIVATE_KEYS
@ WALLET_FLAG_AVOID_REUSE