Use wallet balance for default sendmany account

This commit is contained in:
2026-05-08 17:44:56 -07:00
parent 04862cf7a7
commit 5b23170158
+3 -2
View File
@@ -1004,8 +1004,9 @@ UniValue sendmany(const UniValue& params, bool fHelp)
EnsureWalletIsUnlocked();
// Check funds
CAmount nBalance = GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE);
// Check funds. Treat an empty fromaccount as whole-wallet spendable balance for
// compatibility with modern Bitcoin-family payout callers.
CAmount nBalance = strAccount.empty() ? pwalletMain->GetBalance() : GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE);
if (totalAmount > nBalance)
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");