33 if (!
wallet->DummySignInput(txn.
vin[0], txout, use_max_sig)) {
43 if (!
wallet->DummySignTx(txNew, txouts, use_max_sig)) {
49 return TxSize{vsize, weight};
54 std::vector<CTxOut> txouts;
58 if (mi ==
wallet->mapWallet.end()) {
62 txouts.emplace_back(mi->second.tx->vout[input.
prevout.
n]);
80 std::set<uint256> trusted_parents;
81 for (
const auto& entry : mapWallet)
83 const uint256& wtxid = entry.first;
102 bool safeTx =
IsTrusted(wtx, trusted_parents);
119 if (nDepth == 0 && wtx.
mapValue.count(
"replaces_txid")) {
131 if (nDepth == 0 && wtx.
mapValue.count(
"replaced_by_txid")) {
135 if (only_safe && !safeTx) {
139 if (nDepth < min_depth || nDepth > max_depth) {
143 for (
unsigned int i = 0; i < wtx.
tx->vout.size(); i++) {
149 if (wtx.
tx->vout[i].nValue < nMinimumAmount || wtx.
tx->vout[i].nValue > nMaximumAmount)
167 if (!allow_used_addresses &&
IsSpentKey(wtxid, i)) {
173 bool solvable = provider ?
IsSolvable(*provider, wtx.
tx->vout[i].scriptPubKey) :
false;
180 nTotal += wtx.
tx->vout[i].nValue;
182 if (nTotal >= nMinimumSumAmount) {
188 if (nMaximumCount > 0 &&
vCoins.size() >= nMaximumCount) {
200 std::vector<COutput>
vCoins;
203 if (out.fSpendable) {
204 balance += out.tx->tx->vout[out.i].nValue;
217 auto it = mapWallet.find(prevout.
hash);
218 if (it == mapWallet.end() || it->second.tx->vout.size() <= prevout.
n ||
219 !
IsMine(it->second.tx->vout[prevout.
n])) {
222 ptx = it->second.tx.get();
232 std::map<CTxDestination, std::vector<COutput>> result;
233 std::vector<COutput> availableCoins;
237 for (
const COutput& coin : availableCoins) {
241 result[address].emplace_back(std::move(coin));
245 std::vector<COutPoint> lockedCoins;
250 for (
const COutPoint& output : lockedCoins) {
251 auto it = mapWallet.find(output.hash);
252 if (it != mapWallet.end()) {
253 int depth = it->second.GetDepthInMainChain();
254 if (depth >= 0 && output.n < it->second.tx->vout.size() &&
255 IsMine(it->second.tx->vout[output.n]) == is_mine_filter
259 result[address].emplace_back(
260 &it->second, output.n, depth,
true ,
true ,
false );
271 std::vector<OutputGroup> groups_out;
275 for (
const COutput& output : outputs) {
277 if (!output.fSpendable)
continue;
279 size_t ancestors, descendants;
281 CInputCoin input_coin = output.GetInputCoin();
285 group.Insert(input_coin, output.nDepth, output.tx->IsFromMe(
ISMINE_ALL), ancestors, descendants, positive_only);
288 if (positive_only && group.GetSelectionAmount() <= 0)
continue;
289 if (group.m_outputs.size() > 0 && group.EligibleForSpending(filter)) groups_out.push_back(group);
300 std::map<CScript, std::vector<OutputGroup>> spk_to_groups_map;
301 for (
const auto& output : outputs) {
303 if (!output.fSpendable)
continue;
305 size_t ancestors, descendants;
307 CInputCoin input_coin = output.GetInputCoin();
310 std::vector<OutputGroup>& groups = spk_to_groups_map[spk];
312 if (groups.size() == 0) {
325 groups.emplace_back(coin_sel_params);
326 group = &groups.back();
330 group->
Insert(input_coin, output.nDepth, output.tx->IsFromMe(
ISMINE_ALL), ancestors, descendants, positive_only);
334 for (
const auto& spk_and_groups_pair: spk_to_groups_map) {
335 const std::vector<OutputGroup>& groups_per_spk= spk_and_groups_pair.second;
338 for (
auto group_it = groups_per_spk.rbegin(); group_it != groups_per_spk.rend(); group_it++) {
375 std::vector<COutput>
vCoins(vAvailableCoins);
376 CAmount value_to_select = nTargetValue;
385 nValueRet += out.tx->tx->vout[out.i].nValue;
386 setCoinsRet.insert(out.GetInputCoin());
388 return (nValueRet >= nTargetValue);
392 std::set<CInputCoin> setPresetCoins;
393 CAmount nValueFromPresetInputs = 0;
395 std::vector<COutPoint> vPresetInputs;
397 for (
const COutPoint& outpoint : vPresetInputs)
399 std::map<uint256, CWalletTx>::const_iterator it = mapWallet.find(outpoint.hash);
400 if (it != mapWallet.end())
404 if (wtx.
tx->vout.size() <= outpoint.n) {
410 if (coin.m_input_bytes <= 0) {
415 value_to_select -= coin.txout.nValue;
417 value_to_select -= coin.effective_value;
419 setPresetCoins.insert(coin);
428 if (setPresetCoins.count(it->GetInputCoin()))
434 unsigned int limit_ancestor_count = 0;
435 unsigned int limit_descendant_count = 0;
437 const size_t max_ancestors = (size_t)std::max<int64_t>(1, limit_ancestor_count);
438 const size_t max_descendants = (size_t)std::max<int64_t>(1, limit_descendant_count);
453 const bool res = [&] {
455 if (value_to_select <= 0)
return true;
493 CoinEligibilityFilter(0, 1, std::numeric_limits<uint64_t>::max(), std::numeric_limits<uint64_t>::max(),
true ),
506 nValueRet += nValueFromPresetInputs;
516 constexpr int64_t MAX_ANTI_FEE_SNIPING_TIP_AGE = 8 * 60 * 60;
519 if (block_time < (
GetTime() - MAX_ANTI_FEE_SNIPING_TIP_AGE)) {
553 locktime = block_height;
560 locktime = std::max(0, (
int)locktime -
GetRandInt(100));
572 const std::vector<CRecipient>& vecSend,
575 int& nChangePosInOut,
592 unsigned int outputs_to_subtract_fee_from = 0;
593 for (
const auto& recipient : vecSend) {
594 recipients_sum += recipient.nAmount;
596 if (recipient.fSubtractFeeFromAmount) {
597 outputs_to_subtract_fee_from++;
608 if (!std::get_if<CNoDestination>(&coin_control.
destChange)) {
621 std::string dest_err;
623 error =
strprintf(
_(
"Transaction needs a change address, but we can't generate it. %s"), dest_err);
631 CTxOut change_prototype_txout(0, scriptChange);
638 if (change_spend_size == -1) {
658 error =
_(
"Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.");
679 for (
const auto& recipient : vecSend)
681 CTxOut txout(recipient.nAmount, recipient.scriptPubKey);
690 error =
_(
"Transaction amount too small");
693 txNew.
vout.push_back(txout);
698 CAmount selection_target = recipients_sum + not_input_fees;
701 std::vector<COutput> vAvailableCoins;
706 std::set<CInputCoin> setCoins;
709 error =
_(
"Insufficient funds");
715 const CAmount change_and_fee = inputs_sum - recipients_sum;
716 assert(change_and_fee >= 0);
717 CTxOut newTxOut(change_and_fee, scriptChange);
719 if (nChangePosInOut == -1)
724 else if ((
unsigned int)nChangePosInOut > txNew.
vout.size())
726 error =
_(
"Change index out of range");
730 assert(nChangePosInOut != -1);
731 auto change_position = txNew.
vout.insert(txNew.
vout.begin() + nChangePosInOut, newTxOut);
734 std::vector<CInputCoin> selected_coins(setCoins.begin(), setCoins.end());
746 for (
const auto& coin : selected_coins) {
752 int nBytes = tx_sizes.
vsize;
754 error =
_(
"Signing transaction failed");
762 change_position->nValue -= fee_needed;
768 CAmount change_amount = change_position->nValue;
771 nChangePosInOut = -1;
773 txNew.
vout.erase(change_position);
777 nBytes = tx_sizes.
vsize;
786 if (fee_needed <= change_and_fee - change_amount) {
787 nFeeRet = change_and_fee - change_amount;
792 CAmount to_reduce = fee_needed + change_amount - change_and_fee;
795 for (
const auto& recipient : vecSend)
797 if (i == nChangePosInOut) {
802 if (recipient.fSubtractFeeFromAmount)
804 txout.
nValue -= to_reduce / outputs_to_subtract_fee_from;
809 txout.
nValue -= to_reduce % outputs_to_subtract_fee_from;
815 error =
_(
"The transaction amount is too small to pay the fee");
817 error =
_(
"The transaction amount is too small to send after the fee has been deducted");
824 nFeeRet = fee_needed;
828 if (scriptChange.
empty() && nChangePosInOut != -1) {
833 error =
_(
"Signing transaction failed");
844 error =
_(
"Transaction too large");
856 error =
_(
"Transaction has too long of a mempool chain");
864 fee_calc_out = feeCalc;
866 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",
878 const std::vector<CRecipient>& vecSend,
881 int& nChangePosInOut,
887 if (vecSend.empty()) {
888 error =
_(
"Transaction must have at least one recipient");
892 if (std::any_of(vecSend.cbegin(), vecSend.cend(), [](
const auto& recipient){
return recipient.nAmount < 0; })) {
893 error =
_(
"Transaction amounts must not be negative");
899 int nChangePosIn = nChangePosInOut;
908 int nChangePosInOut2 = nChangePosIn;
913 WalletLogPrintf(
"Fee non-grouped = %lld, grouped = %lld, using %s\n", nFeeRet, nFeeRet2, use_aps ?
"grouped" :
"non-grouped");
917 nChangePosInOut = nChangePosInOut2;
926 std::vector<CRecipient> vecSend;
929 for (
size_t idx = 0; idx < tx.
vout.size(); idx++) {
932 vecSend.push_back(recipient);
947 if (!
CreateTransaction(vecSend, tx_new, nFeeRet, nChangePosInOut,
error, coinControl, fee_calc_out,
false)) {
951 if (nChangePosInOut != -1) {
952 tx.
vout.insert(tx.
vout.begin() + nChangePosInOut, tx_new->vout[nChangePosInOut]);
957 for (
unsigned int idx = 0; idx < tx.
vout.size(); idx++) {
958 tx.
vout[idx].nValue = tx_new->vout[idx].nValue;
962 for (
const CTxIn& txin : tx_new->vin) {
964 tx.
vin.push_back(txin);
std::shared_ptr< const CTransaction > CTransactionRef
static int64_t GetTransactionWeight(const CTransaction &tx)
Helper for findBlock to selectively return pieces of block data.
void AvailableCoins(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) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
populate vCoins with vector of available COutputs.
bool IsWalletFlagSet(uint64_t flag) const override
check if a certain wallet flag is set
virtual void getPackageLimits(unsigned int &limit_ancestor_count, unsigned int &limit_descendant_count)=0
Get the node's package limits.
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 ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
static const uint32_t MAX_BIP125_RBF_SEQUENCE
bool fAllowWatchOnly
Includes watch only addresses which are solvable.
CFeeRate m_effective_feerate
The targeted feerate of the transaction being built.
isminetype IsMine(const CTxDestination &dest) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
size_t change_output_size
Size of a change output in bytes, determined by the output type.
bool IsTrusted(const CWalletTx &wtx, std::set< uint256 > &trusted_parents) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
void Insert(const CInputCoin &output, int depth, bool from_me, size_t ancestors, size_t descendants, bool positive_only)
static const CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
const CTxOut & FindNonChangeParentOutput(const CTransaction &tx, int output) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Find non-change parent output.
static const uint32_t SEQUENCE_FINAL
virtual bool isInitialBlockDownload()=0
Check if in IBD.
void ListSelected(std::vector< COutPoint > &vOutpoints) const
#define CHECK_NONFATAL(condition)
Throw a NonFatalCheckError when the condition evaluates to false.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
bool m_spend_zero_conf_change
Allow Coin Selection to pick unconfirmed UTXOs that were sent from our own wallet if it cannot fund t...
CFeeRate GetDiscardRate(const CWallet &wallet)
Return the maximum feerate for discarding change.
bool FundTransaction(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();.
void insert(Tdst &dst, const Tsrc &src)
Simplification of std insertion.
int m_min_depth
Minimum chain depth value for coin availability.
Use sat/vB fee rate unit.
bilingual_str TransactionErrorString(const TransactionError err)
CAmount m_default_max_tx_fee
Absolute maximum transaction fee (in satoshis) used by default for the wallet.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector< CTxOut > &txouts, bool use_max_sig)
int GetLastBlockHeight() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Get last block processed height.
CAmount m_max_aps_fee
The maximum fee amount we're willing to pay to prioritize partial spend avoidance.
CFeeRate GetMinimumFeeRate(const CWallet &wallet, const CCoinControl &coin_control, FeeCalculation *feeCalc)
Estimate the minimum fee rate considering user set parameters and the required fee.
virtual bool checkFinalTx(const CTransaction &tx)=0
Check if transaction will be final given chain height current time.
const std::vector< CTxIn > vin
std::unique_ptr< SigningProvider > GetSolvingProvider(const CScript &script) const
Get the SigningProvider for a script.
size_t GetSerializeSize(const T &t, int nVersion=0)
bool SelectCoinsBnB(std::vector< OutputGroup > &utxo_pool, const CAmount &selection_target, const CAmount &cost_of_change, std::set< CInputCoin > &out_set, CAmount &value_ret)
mapValue_t mapValue
Key/value map with information about the transaction.
interfaces::Chain & chain() const
Interface for accessing chain state.
bool CreateTransactionInternal(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(cs_wallet)
int64_t CAmount
Amount in satoshis (Can be negative)
bool m_avoid_partial_spends
Avoid partial use of funds sent to a given address.
size_t change_spend_size
Size of the input to spend a change output in virtual bytes.
Parameters for filtering which OutputGroups we may use in coin selection.
bool IsLockedCoin(uint256 hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool m_avoid_partial_spends
When true, always spend all (up to OUTPUT_GROUP_MAX_ENTRIES) or none of the outputs associated with t...
int CalculateMaximumSignedInputSize(const CTxOut &txout, const CWallet *wallet, bool use_max_sig)
const int DEFAULT_MAX_DEPTH
A group of UTXOs paid to the same output script.
int64_t GetVirtualTransactionInputSize(const CTxIn &txin, int64_t nSigOpCost, unsigned int bytes_per_sigop)
int nDepth
Depth in block chain.
std::optional< OutputType > m_default_change_type
Default output type for change outputs.
void WalletLogPrintf(std::string fmt, Params... parameters) const
Prepends the wallet name in logging output to ease debugging in multi-wallet use cases.
An input of a transaction.
std::vector< CInputCoin > m_outputs
The list of UTXOs contained in this output group.
LegacyScriptPubKeyMan * GetLegacyScriptPubKeyMan() const
Get the LegacyScriptPubKeyMan which is used for all types, internal, and external.
bool m_add_inputs
If false, only selected inputs are used.
bilingual_str _(const char *psz)
Translation function.
static secp256k1_context * ctx
CTxDestination destChange
Custom change destination, if not set an address is generated.
void Select(const COutPoint &output)
bool fAllowOtherInputs
If false, allows unselected inputs, but requires all selected inputs be used.
std::string ToString(const FeeEstimateMode &fee_estimate_mode=FeeEstimateMode::BTC_KVB) const
bool m_subtract_fee_outputs
Indicate that we are subtracting the fee from outputs.
const std::vector< CTxOut > vout
static bool IsCurrentForAntiFeeSniping(interfaces::Chain &chain, const uint256 &block_hash)
bool AttemptSelection(const CAmount &nTargetValue, const CoinEligibilityFilter &eligibility_filter, std::vector< COutput > coins, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, const CoinSelectionParams &coin_selection_params) const
Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is st...
CAmount m_change_fee
Cost of creating the change output.
virtual bool findBlock(const uint256 &hash, const FoundBlock &block={})=0
Return whether node has the block and optionally return block metadata or contents.
const int DEFAULT_MIN_DEPTH
uint256 GetLastBlockHash() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
std::vector< OutputGroup > GroupOutputs(const std::vector< COutput > &outputs, const CoinSelectionParams &coin_sel_params, const CoinEligibilityFilter &filter, bool positive_only) const
bool m_avoid_address_reuse
Forbids inclusion of dirty (previously used) addresses.
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
bool m_include_unsafe_inputs
If false, only safe inputs will be used.
bool IsChange(const CTxOut &txout) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
An output of a transaction.
std::string ToString() const
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
const uint256 & GetHash() const
std::optional< bool > m_signal_bip125_rbf
Override the wallet's m_signal_rbf if set.
virtual void getTransactionAncestry(const uint256 &txid, size_t &ancestors, size_t &descendants)=0
Calculate mempool ancestor and descendant counts for the given transaction.
An outpoint - a combination of a transaction hash and an index n into its vout.
size_t tx_noinputs_size
Size of the transaction before coin selection, consisting of the header and recipient output(s)...
std::vector< CTxOut > vout
std::map< CTxDestination, std::vector< COutput > > ListCoins() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Return list of available coins and locked coins grouped by non-change output address.
A transaction with a bunch of additional info that only the owner cares about.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
bool IsSolvable(const SigningProvider &provider, const CScript &script)
void ListLockedCoins(std::vector< COutPoint > &vOutpts) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
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...
bool SelectCoins(const std::vector< COutput > &vAvailableCoins, const CAmount &nTargetValue, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, const CCoinControl &coin_control, CoinSelectionParams &coin_selection_params) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Select a set of coins such that nValueRet >= nTargetValue and at least all coins from coin_control ar...
bool IsImmatureCoinBase() const
void LockCoin(const COutPoint &output) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
static const bool DEFAULT_WALLET_REJECT_LONG_CHAINS
Default for -walletrejectlongchains.
std::string FormatMoney(const CAmount n)
Money parsing/formatting utilities.
std::optional< unsigned int > m_confirm_target
Override the default confirmation target if set.
bool CreateTransaction(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...
void Shuffle(I first, I last, R &&rng)
More efficient than using std::shuffle on a FastRandomContext.
virtual bool checkChainLimits(const CTransactionRef &tx)=0
Check if transaction will pass the mempool's chain limits.
int m_max_depth
Maximum chain depth value for coin availability.
std::optional< CFeeRate > m_feerate
Override the wallet's m_pay_tx_fee if set.
CoinSelectionParams coin_selection_params(0, 0, CFeeRate(0), CFeeRate(0), CFeeRate(0), 0, false)
CAmount m_cost_of_change
Cost of creating the change output + cost of spending the change output in the future.
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
CFeeRate m_discard_feerate
If the cost to spend a change output at the discard feerate exceeds its value, drop it to fees...
bool EligibleForSpending(const CoinEligibilityFilter &eligibility_filter) const
Serialized script, used inside transaction inputs and outputs.
bool GetReservedDestination(CTxDestination &pubkey, bool internal, std::string &error)
Reserve an address.
bool IsSelected(const COutPoint &output) const
static const int PROTOCOL_VERSION
network protocol versioning
static const unsigned int MAX_STANDARD_TX_WEIGHT
The maximum weight for transactions we're willing to relay/mine.
int GetSpendSize(unsigned int out, bool use_max_sig=false) const
Get the marginal bytes if spending the specified output from this transaction.
CAmount GetSelectionAmount() const
int GetDepthInMainChain() const NO_THREAD_SAFETY_ANALYSIS
Return depth of transaction in blockchain: <0 : conflicts with a transaction this deep in the blockch...
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Parameters for one iteration of Coin Selection.
A wrapper to reserve an address from a wallet.
bool KnapsackSolver(const CAmount &nTargetValue, std::vector< OutputGroup > &groups, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet)
CAmount GetFee(uint32_t num_bytes) const
Return the fee in satoshis for the given size in bytes.
RecursiveMutex cs_wallet
Main wallet lock.
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
A mutable version of CTransaction.
virtual unsigned int estimateMaxBlocks()=0
Fee estimator max target.
static std::vector< COutput > vCoins
std::optional< OutputType > m_change_type
Override the default change type if set, ignored if destChange is set.
static constexpr size_t OUTPUT_GROUP_MAX_ENTRIES
bool IsSpent(const uint256 &hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Outpoint is spent if any non-conflicted transaction spends it:
static const unsigned int LOCKTIME_THRESHOLD
The basic transaction that is broadcasted on the network and contained in blocks. ...
bool m_allow_fallback_fee
will be false if -fallbackfee=0
OutputType TransactionChangeType(const std::optional< OutputType > &change_type, const std::vector< CRecipient > &vecSend) const
bool IsSpentKey(const uint256 &hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
int64_t GetTime()
Return system time (or mocked time, if set)
CFeeRate m_long_term_feerate
The feerate estimate used to estimate an upper bound on what should be sufficient to spend the change...
std::string ToString() const
int GetRandInt(int nMax) noexcept
bool error(const char *fmt, const Args &... args)
std::string StringForFeeReason(FeeReason reason)
bool SignTransaction(CMutableTransaction &tx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Fetch the inputs and sign with SIGHASH_ALL.
CAmount GetAvailableBalance(const CCoinControl *coinControl=nullptr) const
#define Assert(val)
Identity function.
void emplace_back(Args &&... args)
void KeepDestination()
Keep the address. Do not return it's key to the keypool when this object goes out of scope...
static constexpr size_t DUMMY_NESTED_P2WPKH_INPUT_SIZE
Pre-calculated constants for input size estimation in virtual size