aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/spend.cpp
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2023-08-09 09:42:04 -0400
committerAndrew Chow <github@achow101.com>2023-09-12 12:14:31 -0400
commitad0c469d98c51931b98b7fd937c6ac3eeaed024e (patch)
treeb775fbf14245282b5d276550d9eda1086c6251a5 /src/wallet/spend.cpp
parent07d3bdf4ebc06825ea24ab6f7c87aef6a22238c6 (diff)
downloadbitcoin-ad0c469d98c51931b98b7fd937c6ac3eeaed024e.tar.xz
wallet: Use CTxDestination in CRecipient rather than scriptPubKey
Diffstat (limited to 'src/wallet/spend.cpp')
-rw-r--r--src/wallet/spend.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index 5d2c299a69..45f0ece860 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -1044,7 +1044,7 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
// vouts to the payees
for (const auto& recipient : vecSend)
{
- CTxOut txout(recipient.nAmount, recipient.scriptPubKey);
+ CTxOut txout(recipient.nAmount, GetScriptForDestination(recipient.dest));
// Include the fee cost for outputs.
coin_selection_params.tx_noinputs_size += ::GetSerializeSize(txout, PROTOCOL_VERSION);
@@ -1292,7 +1292,9 @@ bool FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& nFeeRet,
// Turn the txout set into a CRecipient vector.
for (size_t idx = 0; idx < tx.vout.size(); idx++) {
const CTxOut& txOut = tx.vout[idx];
- CRecipient recipient = {txOut.scriptPubKey, txOut.nValue, setSubtractFeeFromOutputs.count(idx) == 1};
+ CTxDestination dest;
+ ExtractDestination(txOut.scriptPubKey, dest);
+ CRecipient recipient = {dest, txOut.nValue, setSubtractFeeFromOutputs.count(idx) == 1};
vecSend.push_back(recipient);
}