mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
Make CoinControl a required argument to CreateTransaction
This commit is contained in:
parent
8fdd23a224
commit
ecd81dfa3c
7 changed files with 27 additions and 28 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue