mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Make CoinControl a required argument to CreateTransaction
This commit is contained in:
@@ -356,7 +356,7 @@ UniValue getaddressesbyaccount(const JSONRPCRequest& request)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount, CWalletTx& wtxNew, CCoinControl *coin_control = nullptr)
|
||||
static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount, CWalletTx& wtxNew, const CCoinControl& coin_control)
|
||||
{
|
||||
CAmount curBalance = pwallet->GetBalance();
|
||||
|
||||
@@ -472,7 +472,7 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
SendMoney(pwallet, address.Get(), nAmount, fSubtractFeeFromAmount, wtx, &coin_control);
|
||||
SendMoney(pwallet, address.Get(), nAmount, fSubtractFeeFromAmount, wtx, coin_control);
|
||||
|
||||
return wtx.GetHash().GetHex();
|
||||
}
|
||||
@@ -898,7 +898,8 @@ UniValue sendfrom(const JSONRPCRequest& request)
|
||||
if (nAmount > nBalance)
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
|
||||
|
||||
SendMoney(pwallet, address.Get(), nAmount, false, wtx);
|
||||
CCoinControl no_coin_control; // This is a deprecated API
|
||||
SendMoney(pwallet, address.Get(), nAmount, false, wtx, no_coin_control);
|
||||
|
||||
return wtx.GetHash().GetHex();
|
||||
}
|
||||
@@ -1033,7 +1034,7 @@ UniValue sendmany(const JSONRPCRequest& request)
|
||||
CAmount nFeeRequired = 0;
|
||||
int nChangePosRet = -1;
|
||||
std::string strFailReason;
|
||||
bool fCreated = pwallet->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason, &coin_control);
|
||||
bool fCreated = pwallet->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason, coin_control);
|
||||
if (!fCreated)
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason);
|
||||
CValidationState state;
|
||||
|
||||
Reference in New Issue
Block a user