diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-06-20 12:03:03 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-12-08 14:55:14 -0500 |
commit | 596642c5a9f52dda2599b0bde424366bb22b3c6e (patch) | |
tree | c4636f73d25fadf81507374125348fda18805cc3 /src/wallet/spend.cpp | |
parent | 5321786b9d90eaf35059bb07e6beaaa2cbb257ac (diff) | |
download | bitcoin-596642c5a9f52dda2599b0bde424366bb22b3c6e.tar.xz |
wallet: Replace SelectExternal with SetTxOut
Instead of having a separate CCoinControl::SelectExternal function, we
can use the normal CCoinControl::Select function and explicitly use
PreselectedInput::SetTxOut in the caller. The semantics of what an
external input is remains.
Diffstat (limited to 'src/wallet/spend.cpp')
-rw-r--r-- | src/wallet/spend.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index 2fb238fccd..c3fd695eb9 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -1347,15 +1347,15 @@ bool FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& nFeeRet, for (const CTxIn& txin : tx.vin) { const auto& outPoint = txin.prevout; - if (wallet.IsMine(outPoint)) { - // The input was found in the wallet, so select as internal - coinControl.Select(outPoint); - } else if (coins[outPoint].out.IsNull()) { - error = _("Unable to find UTXO for external input"); - return false; - } else { + PreselectedInput& preset_txin = coinControl.Select(outPoint); + if (!wallet.IsMine(outPoint)) { + if (coins[outPoint].out.IsNull()) { + error = _("Unable to find UTXO for external input"); + return false; + } + // The input was not in the wallet, but is in the UTXO set, so select as external - coinControl.SelectExternal(outPoint, coins[outPoint].out); + preset_txin.SetTxOut(coins[outPoint].out); } } |