Use wallet balance for default sendmany account
This commit is contained in:
@@ -1004,8 +1004,9 @@ UniValue sendmany(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
EnsureWalletIsUnlocked();
|
EnsureWalletIsUnlocked();
|
||||||
|
|
||||||
// Check funds
|
// Check funds. Treat an empty fromaccount as whole-wallet spendable balance for
|
||||||
CAmount nBalance = GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE);
|
// compatibility with modern Bitcoin-family payout callers.
|
||||||
|
CAmount nBalance = strAccount.empty() ? pwalletMain->GetBalance() : GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE);
|
||||||
if (totalAmount > nBalance)
|
if (totalAmount > nBalance)
|
||||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
|
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user