Bitcoin Core  24.99.0
P2P Digital Currency
feebumper.cpp
Go to the documentation of this file.
1 // Copyright (c) 2017-2022 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 #include <consensus/validation.h>
6 #include <interfaces/chain.h>
7 #include <policy/fees.h>
8 #include <policy/policy.h>
9 #include <util/moneystr.h>
10 #include <util/rbf.h>
11 #include <util/system.h>
12 #include <util/translation.h>
13 #include <wallet/coincontrol.h>
14 #include <wallet/feebumper.h>
15 #include <wallet/fees.h>
16 #include <wallet/receive.h>
17 #include <wallet/spend.h>
18 #include <wallet/wallet.h>
19 
20 namespace wallet {
23 static feebumper::Result PreconditionChecks(const CWallet& wallet, const CWalletTx& wtx, bool require_mine, std::vector<bilingual_str>& errors) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
24 {
25  if (wallet.HasWalletSpend(wtx.tx)) {
26  errors.push_back(Untranslated("Transaction has descendants in the wallet"));
28  }
29 
30  {
31  if (wallet.chain().hasDescendantsInMempool(wtx.GetHash())) {
32  errors.push_back(Untranslated("Transaction has descendants in the mempool"));
34  }
35  }
36 
37  if (wallet.GetTxDepthInMainChain(wtx) != 0) {
38  errors.push_back(Untranslated("Transaction has been mined, or is conflicted with a mined transaction"));
40  }
41 
42  if (!SignalsOptInRBF(*wtx.tx)) {
43  errors.push_back(Untranslated("Transaction is not BIP 125 replaceable"));
45  }
46 
47  if (wtx.mapValue.count("replaced_by_txid")) {
48  errors.push_back(strprintf(Untranslated("Cannot bump transaction %s which was already bumped by transaction %s"), wtx.GetHash().ToString(), wtx.mapValue.at("replaced_by_txid")));
50  }
51 
52  if (require_mine) {
53  // check that original tx consists entirely of our inputs
54  // if not, we can't bump the fee, because the wallet has no way of knowing the value of the other inputs (thus the fee)
55  isminefilter filter = wallet.GetLegacyScriptPubKeyMan() && wallet.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) ? ISMINE_WATCH_ONLY : ISMINE_SPENDABLE;
56  if (!AllInputsMine(wallet, *wtx.tx, filter)) {
57  errors.push_back(Untranslated("Transaction contains inputs that don't belong to this wallet"));
59  }
60  }
61 
62  return feebumper::Result::OK;
63 }
64 
66 static feebumper::Result CheckFeeRate(const CWallet& wallet, const CWalletTx& wtx, const CFeeRate& newFeerate, const int64_t maxTxSize, CAmount old_fee, std::vector<bilingual_str>& errors)
67 {
68  // check that fee rate is higher than mempool's minimum fee
69  // (no point in bumping fee if we know that the new tx won't be accepted to the mempool)
70  // This may occur if the user set fee_rate or paytxfee too low, if fallbackfee is too low, or, perhaps,
71  // in a rare situation where the mempool minimum fee increased significantly since the fee estimation just a
72  // moment earlier. In this case, we report an error to the user, who may adjust the fee.
73  CFeeRate minMempoolFeeRate = wallet.chain().mempoolMinFee();
74 
75  if (newFeerate.GetFeePerK() < minMempoolFeeRate.GetFeePerK()) {
76  errors.push_back(strprintf(
77  Untranslated("New fee rate (%s) is lower than the minimum fee rate (%s) to get into the mempool -- "),
78  FormatMoney(newFeerate.GetFeePerK()),
79  FormatMoney(minMempoolFeeRate.GetFeePerK())));
81  }
82 
83  CAmount new_total_fee = newFeerate.GetFee(maxTxSize);
84 
85  CFeeRate incrementalRelayFee = std::max(wallet.chain().relayIncrementalFee(), CFeeRate(WALLET_INCREMENTAL_RELAY_FEE));
86 
87  // Given old total fee and transaction size, calculate the old feeRate
88  const int64_t txSize = GetVirtualTransactionSize(*(wtx.tx));
89  CFeeRate nOldFeeRate(old_fee, txSize);
90  // Min total fee is old fee + relay fee
91  CAmount minTotalFee = nOldFeeRate.GetFee(maxTxSize) + incrementalRelayFee.GetFee(maxTxSize);
92 
93  if (new_total_fee < minTotalFee) {
94  errors.push_back(strprintf(Untranslated("Insufficient total fee %s, must be at least %s (oldFee %s + incrementalFee %s)"),
95  FormatMoney(new_total_fee), FormatMoney(minTotalFee), FormatMoney(nOldFeeRate.GetFee(maxTxSize)), FormatMoney(incrementalRelayFee.GetFee(maxTxSize))));
97  }
98 
99  CAmount requiredFee = GetRequiredFee(wallet, maxTxSize);
100  if (new_total_fee < requiredFee) {
101  errors.push_back(strprintf(Untranslated("Insufficient total fee (cannot be less than required fee %s)"),
102  FormatMoney(requiredFee)));
104  }
105 
106  // Check that in all cases the new fee doesn't violate maxTxFee
107  const CAmount max_tx_fee = wallet.m_default_max_tx_fee;
108  if (new_total_fee > max_tx_fee) {
109  errors.push_back(strprintf(Untranslated("Specified or calculated fee %s is too high (cannot be higher than -maxtxfee %s)"),
110  FormatMoney(new_total_fee), FormatMoney(max_tx_fee)));
112  }
113 
114  return feebumper::Result::OK;
115 }
116 
117 static CFeeRate EstimateFeeRate(const CWallet& wallet, const CWalletTx& wtx, const CAmount old_fee, const CCoinControl& coin_control)
118 {
119  // Get the fee rate of the original transaction. This is calculated from
120  // the tx fee/vsize, so it may have been rounded down. Add 1 satoshi to the
121  // result.
122  int64_t txSize = GetVirtualTransactionSize(*(wtx.tx));
123  CFeeRate feerate(old_fee, txSize);
124  feerate += CFeeRate(1);
125 
126  // The node has a configurable incremental relay fee. Increment the fee by
127  // the minimum of that and the wallet's conservative
128  // WALLET_INCREMENTAL_RELAY_FEE value to future proof against changes to
129  // network wide policy for incremental relay fee that our node may not be
130  // aware of. This ensures we're over the required relay fee rate
131  // (Rule 4). The replacement tx will be at least as large as the
132  // original tx, so the total fee will be greater (Rule 3)
133  CFeeRate node_incremental_relay_fee = wallet.chain().relayIncrementalFee();
134  CFeeRate wallet_incremental_relay_fee = CFeeRate(WALLET_INCREMENTAL_RELAY_FEE);
135  feerate += std::max(node_incremental_relay_fee, wallet_incremental_relay_fee);
136 
137  // Fee rate must also be at least the wallet's GetMinimumFeeRate
138  CFeeRate min_feerate(GetMinimumFeeRate(wallet, coin_control, /*feeCalc=*/nullptr));
139 
140  // Set the required fee rate for the replacement transaction in coin control.
141  return std::max(feerate, min_feerate);
142 }
143 
144 namespace feebumper {
145 
146 bool TransactionCanBeBumped(const CWallet& wallet, const uint256& txid)
147 {
148  LOCK(wallet.cs_wallet);
149  const CWalletTx* wtx = wallet.GetWalletTx(txid);
150  if (wtx == nullptr) return false;
151 
152  std::vector<bilingual_str> errors_dummy;
153  feebumper::Result res = PreconditionChecks(wallet, *wtx, /* require_mine=*/ true, errors_dummy);
154  return res == feebumper::Result::OK;
155 }
156 
157 Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCoinControl& coin_control, std::vector<bilingual_str>& errors,
158  CAmount& old_fee, CAmount& new_fee, CMutableTransaction& mtx, bool require_mine, const std::vector<CTxOut>& outputs)
159 {
160  // We are going to modify coin control later, copy to re-use
161  CCoinControl new_coin_control(coin_control);
162 
163  LOCK(wallet.cs_wallet);
164  errors.clear();
165  auto it = wallet.mapWallet.find(txid);
166  if (it == wallet.mapWallet.end()) {
167  errors.push_back(Untranslated("Invalid or non-wallet transaction id"));
169  }
170  const CWalletTx& wtx = it->second;
171 
172  // Retrieve all of the UTXOs and add them to coin control
173  // While we're here, calculate the input amount
174  std::map<COutPoint, Coin> coins;
175  CAmount input_value = 0;
176  std::vector<CTxOut> spent_outputs;
177  for (const CTxIn& txin : wtx.tx->vin) {
178  coins[txin.prevout]; // Create empty map entry keyed by prevout.
179  }
180  wallet.chain().findCoins(coins);
181  for (const CTxIn& txin : wtx.tx->vin) {
182  const Coin& coin = coins.at(txin.prevout);
183  if (coin.out.IsNull()) {
184  errors.push_back(Untranslated(strprintf("%s:%u is already spent", txin.prevout.hash.GetHex(), txin.prevout.n)));
185  return Result::MISC_ERROR;
186  }
187  if (wallet.IsMine(txin.prevout)) {
188  new_coin_control.Select(txin.prevout);
189  } else {
190  new_coin_control.SelectExternal(txin.prevout, coin.out);
191  }
192  input_value += coin.out.nValue;
193  spent_outputs.push_back(coin.out);
194  }
195 
196  // Figure out if we need to compute the input weight, and do so if necessary
198  txdata.Init(*wtx.tx, std::move(spent_outputs), /* force=*/ true);
199  for (unsigned int i = 0; i < wtx.tx->vin.size(); ++i) {
200  const CTxIn& txin = wtx.tx->vin.at(i);
201  const Coin& coin = coins.at(txin.prevout);
202 
203  if (new_coin_control.IsExternalSelected(txin.prevout)) {
204  // For external inputs, we estimate the size using the size of this input
205  int64_t input_weight = GetTransactionInputWeight(txin);
206  // Because signatures can have different sizes, we need to figure out all of the
207  // signature sizes and replace them with the max sized signature.
208  // In order to do this, we verify the script with a special SignatureChecker which
209  // will observe the signatures verified and record their sizes.
210  SignatureWeights weights;
211  TransactionSignatureChecker tx_checker(wtx.tx.get(), i, coin.out.nValue, txdata, MissingDataBehavior::FAIL);
212  SignatureWeightChecker size_checker(weights, tx_checker);
214  // Add the difference between max and current to input_weight so that it represents the largest the input could be
215  input_weight += weights.GetWeightDiffToMax();
216  new_coin_control.SetInputWeight(txin.prevout, input_weight);
217  }
218  }
219 
220  Result result = PreconditionChecks(wallet, wtx, require_mine, errors);
221  if (result != Result::OK) {
222  return result;
223  }
224 
225  // Calculate the old output amount.
226  CAmount output_value = 0;
227  for (const auto& old_output : wtx.tx->vout) {
228  output_value += old_output.nValue;
229  }
230 
231  old_fee = input_value - output_value;
232 
233  // Fill in recipients (and preserve a single change key if there
234  // is one). If outputs vector is non-empty, replace original
235  // outputs with its contents, otherwise use original outputs.
236  std::vector<CRecipient> recipients;
237  for (const auto& output : outputs.empty() ? wtx.tx->vout : outputs) {
238  if (!OutputIsChange(wallet, output)) {
239  CRecipient recipient = {output.scriptPubKey, output.nValue, false};
240  recipients.push_back(recipient);
241  } else {
242  CTxDestination change_dest;
243  ExtractDestination(output.scriptPubKey, change_dest);
244  new_coin_control.destChange = change_dest;
245  }
246  }
247 
248  if (coin_control.m_feerate) {
249  // The user provided a feeRate argument.
250  // We calculate this here to avoid compiler warning on the cs_wallet lock
251  // We need to make a temporary transaction with no input witnesses as the dummy signer expects them to be empty for external inputs
252  CMutableTransaction mtx{*wtx.tx};
253  for (auto& txin : mtx.vin) {
254  txin.scriptSig.clear();
255  txin.scriptWitness.SetNull();
256  }
257  const int64_t maxTxSize{CalculateMaximumSignedTxSize(CTransaction(mtx), &wallet, &new_coin_control).vsize};
258  Result res = CheckFeeRate(wallet, wtx, *new_coin_control.m_feerate, maxTxSize, old_fee, errors);
259  if (res != Result::OK) {
260  return res;
261  }
262  } else {
263  // The user did not provide a feeRate argument
264  new_coin_control.m_feerate = EstimateFeeRate(wallet, wtx, old_fee, new_coin_control);
265  }
266 
267  // Fill in required inputs we are double-spending(all of them)
268  // N.B.: bip125 doesn't require all the inputs in the replaced transaction to be
269  // used in the replacement transaction, but it's very important for wallets to make
270  // sure that happens. If not, it would be possible to bump a transaction A twice to
271  // A2 and A3 where A2 and A3 don't conflict (or alternatively bump A to A2 and A2
272  // to A3 where A and A3 don't conflict). If both later get confirmed then the sender
273  // has accidentally double paid.
274  for (const auto& inputs : wtx.tx->vin) {
275  new_coin_control.Select(COutPoint(inputs.prevout));
276  }
277  new_coin_control.m_allow_other_inputs = true;
278 
279  // We cannot source new unconfirmed inputs(bip125 rule 2)
280  new_coin_control.m_min_depth = 1;
281 
282  constexpr int RANDOM_CHANGE_POSITION = -1;
283  auto res = CreateTransaction(wallet, recipients, RANDOM_CHANGE_POSITION, new_coin_control, false);
284  if (!res) {
285  errors.push_back(Untranslated("Unable to create transaction.") + Untranslated(" ") + util::ErrorString(res));
286  return Result::WALLET_ERROR;
287  }
288 
289  const auto& txr = *res;
290  // Write back new fee if successful
291  new_fee = txr.fee;
292 
293  // Write back transaction
294  mtx = CMutableTransaction(*txr.tx);
295 
296  return Result::OK;
297 }
298 
300  LOCK(wallet.cs_wallet);
301 
302  if (wallet.IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER)) {
303  // Make a blank psbt
304  PartiallySignedTransaction psbtx(mtx);
305 
306  // First fill transaction with our data without signing,
307  // so external signers are not asked to sign more than once.
308  bool complete;
309  wallet.FillPSBT(psbtx, complete, SIGHASH_ALL, false /* sign */, true /* bip32derivs */);
310  const TransactionError err = wallet.FillPSBT(psbtx, complete, SIGHASH_ALL, true /* sign */, false /* bip32derivs */);
311  if (err != TransactionError::OK) return false;
312  complete = FinalizeAndExtractPSBT(psbtx, mtx);
313  return complete;
314  } else {
315  return wallet.SignTransaction(mtx);
316  }
317 }
318 
319 Result CommitTransaction(CWallet& wallet, const uint256& txid, CMutableTransaction&& mtx, std::vector<bilingual_str>& errors, uint256& bumped_txid)
320 {
321  LOCK(wallet.cs_wallet);
322  if (!errors.empty()) {
323  return Result::MISC_ERROR;
324  }
325  auto it = txid.IsNull() ? wallet.mapWallet.end() : wallet.mapWallet.find(txid);
326  if (it == wallet.mapWallet.end()) {
327  errors.push_back(Untranslated("Invalid or non-wallet transaction id"));
328  return Result::MISC_ERROR;
329  }
330  const CWalletTx& oldWtx = it->second;
331 
332  // make sure the transaction still has no descendants and hasn't been mined in the meantime
333  Result result = PreconditionChecks(wallet, oldWtx, /* require_mine=*/ false, errors);
334  if (result != Result::OK) {
335  return result;
336  }
337 
338  // commit/broadcast the tx
339  CTransactionRef tx = MakeTransactionRef(std::move(mtx));
340  mapValue_t mapValue = oldWtx.mapValue;
341  mapValue["replaces_txid"] = oldWtx.GetHash().ToString();
342 
343  wallet.CommitTransaction(tx, std::move(mapValue), oldWtx.vOrderForm);
344 
345  // mark the original tx as bumped
346  bumped_txid = tx->GetHash();
347  if (!wallet.MarkReplaced(oldWtx.GetHash(), bumped_txid)) {
348  errors.push_back(Untranslated("Created new bumpfee transaction but could not mark the original transaction as replaced"));
349  }
350  return Result::OK;
351 }
352 
353 } // namespace feebumper
354 } // namespace wallet
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
Definition: feerate.h:33
CAmount GetFee(uint32_t num_bytes) const
Return the fee in satoshis for the given vsize in vbytes.
Definition: feerate.cpp:23
CAmount GetFeePerK() const
Return the fee in satoshis for a vsize of 1000 vbytes.
Definition: feerate.h:65
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:36
uint32_t n
Definition: transaction.h:39
uint256 hash
Definition: transaction.h:38
void clear()
Definition: script.h:554
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:295
An input of a transaction.
Definition: transaction.h:75
CScript scriptSig
Definition: transaction.h:78
CScriptWitness scriptWitness
Only serialized through CTransaction.
Definition: transaction.h:80
COutPoint prevout
Definition: transaction.h:77
CScript scriptPubKey
Definition: transaction.h:161
CAmount nValue
Definition: transaction.h:160
bool IsNull() const
Definition: transaction.h:178
A UTXO entry.
Definition: coins.h:31
CTxOut out
unspent transaction output
Definition: coins.h:34
constexpr bool IsNull() const
Definition: uint256.h:41
std::string ToString() const
Definition: uint256.cpp:55
std::string GetHex() const
Definition: uint256.cpp:11
void push_back(const T &value)
Definition: prevector.h:431
256-bit opaque blob.
Definition: uint256.h:105
Coin Control Features.
Definition: coincontrol.h:30
void Select(const COutPoint &output)
Definition: coincontrol.h:91
void SelectExternal(const COutPoint &outpoint, const CTxOut &txout)
Definition: coincontrol.h:96
int m_min_depth
Minimum chain depth value for coin availability.
Definition: coincontrol.h:58
bool m_allow_other_inputs
If true, the selection process can add extra unselected inputs from the wallet while requires all sel...
Definition: coincontrol.h:40
void SetInputWeight(const COutPoint &outpoint, int64_t weight)
Definition: coincontrol.h:117
std::optional< CFeeRate > m_feerate
Override the wallet's m_pay_tx_fee if set.
Definition: coincontrol.h:46
bool IsExternalSelected(const COutPoint &output) const
Definition: coincontrol.h:76
CTxDestination destChange
Custom change destination, if not set an address is generated.
Definition: coincontrol.h:33
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:237
A transaction with a bunch of additional info that only the owner cares about.
Definition: transaction.h:138
std::vector< std::pair< std::string, std::string > > vOrderForm
Definition: transaction.h:166
mapValue_t mapValue
Key/value map with information about the transaction.
Definition: transaction.h:165
CTransactionRef tx
Definition: transaction.h:219
const uint256 & GetHash() const
Definition: transaction.h:299
static int64_t GetTransactionInputWeight(const CTxIn &txin)
Definition: validation.h:156
TransactionError
Definition: error.h:22
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, unsigned int flags, const BaseSignatureChecker &checker, ScriptError *serror)
@ SIGHASH_ALL
Definition: interpreter.h:28
@ FAIL
Just act as if the signature was invalid.
std::string FormatMoney(const CAmount n)
Money parsing/formatting utilities.
Definition: moneystr.cpp:16
bilingual_str ErrorString(const Result< T > &result)
Definition: result.h:78
Result CommitTransaction(CWallet &wallet, const uint256 &txid, CMutableTransaction &&mtx, std::vector< bilingual_str > &errors, uint256 &bumped_txid)
Commit the bumpfee transaction.
Definition: feebumper.cpp:319
bool SignTransaction(CWallet &wallet, CMutableTransaction &mtx)
Sign the new transaction,.
Definition: feebumper.cpp:299
bool TransactionCanBeBumped(const CWallet &wallet, const uint256 &txid)
Return whether transaction can be bumped.
Definition: feebumper.cpp:146
Result CreateRateBumpTransaction(CWallet &wallet, const uint256 &txid, const CCoinControl &coin_control, std::vector< bilingual_str > &errors, CAmount &old_fee, CAmount &new_fee, CMutableTransaction &mtx, bool require_mine, const std::vector< CTxOut > &outputs)
Create bumpfee transaction based on feerate estimates.
Definition: feebumper.cpp:157
Definition: node.h:39
bool OutputIsChange(const CWallet &wallet, const CTxOut &txout)
Definition: receive.cpp:73
std::map< std::string, std::string > mapValue_t
Definition: transaction.h:111
static feebumper::Result PreconditionChecks(const CWallet &wallet, const CWalletTx &wtx, bool require_mine, std::vector< bilingual_str > &errors) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Check whether transaction has descendant in wallet or mempool, or has been mined, or conflicts with a...
Definition: feebumper.cpp:23
std::underlying_type< isminetype >::type isminefilter
used for bitflags of isminetype
Definition: wallet.h:41
util::Result< CreatedTransactionResult > CreateTransaction(CWallet &wallet, const std::vector< CRecipient > &vecSend, int change_pos, const CCoinControl &coin_control, bool sign)
Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also cr...
Definition: spend.cpp:1136
CFeeRate GetMinimumFeeRate(const CWallet &wallet, const CCoinControl &coin_control, FeeCalculation *feeCalc)
Estimate the minimum fee rate considering user set parameters and the required fee.
Definition: fees.cpp:29
static CFeeRate EstimateFeeRate(const CWallet &wallet, const CWalletTx &wtx, const CAmount old_fee, const CCoinControl &coin_control)
Definition: feebumper.cpp:117
@ ISMINE_SPENDABLE
Definition: ismine.h:44
@ ISMINE_WATCH_ONLY
Definition: ismine.h:43
static feebumper::Result CheckFeeRate(const CWallet &wallet, const CWalletTx &wtx, const CFeeRate &newFeerate, const int64_t maxTxSize, CAmount old_fee, std::vector< bilingual_str > &errors)
Check if the user provided a valid feeRate.
Definition: feebumper.cpp:66
bool AllInputsMine(const CWallet &wallet, const CTransaction &tx, const isminefilter &filter)
Returns whether all of the inputs match the filter.
Definition: receive.cpp:22
static const CAmount WALLET_INCREMENTAL_RELAY_FEE
minimum recommended increment for replacement txs
Definition: wallet.h:98
TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector< CTxOut > &txouts, const CCoinControl *coin_control)
Calculate the size of the transaction using CoinControl to determine whether to expect signature grin...
Definition: spend.cpp:50
@ WALLET_FLAG_EXTERNAL_SIGNER
Indicates that the wallet needs an external signer.
Definition: walletutil.h:69
@ WALLET_FLAG_DISABLE_PRIVATE_KEYS
Definition: walletutil.h:51
CAmount GetRequiredFee(const CWallet &wallet, unsigned int nTxBytes)
Return the minimum required absolute fee for this size based on the required fee rate.
Definition: fees.cpp:13
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
Definition: policy.cpp:295
static constexpr unsigned int STANDARD_SCRIPT_VERIFY_FLAGS
Standard script verification flags that standard transactions will comply with.
Definition: policy.h:77
static CTransactionRef MakeTransactionRef(Tx &&txIn)
Definition: transaction.h:422
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:421
bool FinalizeAndExtractPSBT(PartiallySignedTransaction &psbtx, CMutableTransaction &result)
Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized.
Definition: psbt.cpp:460
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
Definition: standard.cpp:237
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:149
A mutable version of CTransaction.
Definition: transaction.h:380
std::vector< CTxIn > vin
Definition: transaction.h:381
void SetNull()
Definition: script.h:573
A version of CTransaction with the PSBT format.
Definition: psbt.h:947
void Init(const T &tx, std::vector< CTxOut > &&spent_outputs, bool force=false)
Initialize this PrecomputedTransactionData with transaction data.
CScript scriptPubKey
Definition: wallet.h:227
int64_t vsize
Definition: spend.h:23
int64_t GetWeightDiffToMax() const
Definition: feebumper.h:96
#define LOCK(cs)
Definition: sync.h:258
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:49
#define strprintf
Format arguments and return the string or write to given std::ostream (see tinyformat::format doc for...
Definition: tinyformat.h:1162
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
Definition: translation.h:48
bool SignalsOptInRBF(const CTransaction &tx)
Check whether the sequence numbers on this transaction are signaling opt-in to replace-by-fee,...
Definition: rbf.cpp:9