aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wallet/coincontrol.h5
-rw-r--r--src/wallet/rpc/spend.cpp10
-rw-r--r--src/wallet/spend.cpp7
3 files changed, 7 insertions, 15 deletions
diff --git a/src/wallet/coincontrol.h b/src/wallet/coincontrol.h
index 65a5c83366..e9687de14d 100644
--- a/src/wallet/coincontrol.h
+++ b/src/wallet/coincontrol.h
@@ -33,11 +33,10 @@ public:
CTxDestination destChange = CNoDestination();
//! Override the default change type if set, ignored if destChange is set
std::optional<OutputType> m_change_type;
- //! If false, only selected inputs are used
- bool m_add_inputs = true;
//! If false, only safe inputs will be used
bool m_include_unsafe_inputs = false;
- //! If false, allows unselected inputs, but requires all selected inputs be used
+ //! If true, the selection process can add extra unselected inputs from the wallet
+ //! while requires all selected inputs be used
bool fAllowOtherInputs = false;
//! Includes watch only addresses which are solvable
bool fAllowWatchOnly = false;
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp
index e2ea2b691d..0aaa3c2ac3 100644
--- a/src/wallet/rpc/spend.cpp
+++ b/src/wallet/rpc/spend.cpp
@@ -535,8 +535,8 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out,
},
true, true);
- if (options.exists("add_inputs") ) {
- coinControl.m_add_inputs = options["add_inputs"].get_bool();
+ if (options.exists("add_inputs")) {
+ coinControl.fAllowOtherInputs = options["add_inputs"].get_bool();
}
if (options.exists("changeAddress") || options.exists("change_address")) {
@@ -823,7 +823,7 @@ RPCHelpMan fundrawtransaction()
int change_position;
CCoinControl coin_control;
// Automatically select (additional) coins. Can be overridden by options.add_inputs.
- coin_control.m_add_inputs = true;
+ coin_control.fAllowOtherInputs = true;
FundTransaction(*pwallet, tx, fee, change_position, request.params[1], coin_control, /*override_min_fee=*/true);
UniValue result(UniValue::VOBJ);
@@ -1225,7 +1225,7 @@ RPCHelpMan send()
CCoinControl coin_control;
// Automatically select coins, unless at least one is manually selected. Can
// be overridden by options.add_inputs.
- coin_control.m_add_inputs = rawTx.vin.size() == 0;
+ coin_control.fAllowOtherInputs = rawTx.vin.size() == 0;
SetOptionsInputWeights(options["inputs"], options);
FundTransaction(*pwallet, rawTx, fee, change_position, options, coin_control, /*override_min_fee=*/false);
@@ -1649,7 +1649,7 @@ RPCHelpMan walletcreatefundedpsbt()
CCoinControl coin_control;
// Automatically select coins, unless at least one is manually selected. Can
// be overridden by options.add_inputs.
- coin_control.m_add_inputs = rawTx.vin.size() == 0;
+ coin_control.fAllowOtherInputs = rawTx.vin.size() == 0;
SetOptionsInputWeights(request.params[0], options);
FundTransaction(wallet, rawTx, fee, change_position, options, coin_control, /*override_min_fee=*/true);
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index 4547dc4133..693158fafb 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -168,11 +168,6 @@ CoinsResult AvailableCoins(const CWallet& wallet,
const CTxOut& output = wtx.tx->vout[i];
const COutPoint outpoint(wtxid, i);
- // Only consider selected coins if add_inputs is false
- if (coinControl && !coinControl->m_add_inputs && !coinControl->IsSelected(outpoint)) {
- continue;
- }
-
if (output.nValue < nMinimumAmount || output.nValue > nMaximumAmount)
continue;
@@ -1033,8 +1028,6 @@ bool FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& nFeeRet,
vecSend.push_back(recipient);
}
- coinControl.fAllowOtherInputs = true;
-
// Acquire the locks to prevent races to the new locked unspents between the
// CreateTransaction call and LockCoin calls (when lockUnspents is true).
LOCK(wallet.cs_wallet);