Skip to content

Commit df10f07

Browse files
committed
[wallet] Don't use accounts when checking balance in sendmany
1 parent e209184 commit df10f07

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,9 +1263,11 @@ static UniValue sendmany(const JSONRPCRequest& request)
12631263
EnsureWalletIsUnlocked(pwallet);
12641264

12651265
// Check funds
1266-
CAmount nBalance = pwallet->GetLegacyBalance(ISMINE_SPENDABLE, nMinDepth, &strAccount);
1267-
if (totalAmount > nBalance)
1266+
if (IsDeprecatedRPCEnabled("accounts") && totalAmount > pwallet->GetLegacyBalance(ISMINE_SPENDABLE, nMinDepth, &strAccount)) {
12681267
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
1268+
} else if (!IsDeprecatedRPCEnabled("accounts") && totalAmount > pwallet->GetLegacyBalance(ISMINE_SPENDABLE, nMinDepth, nullptr)) {
1269+
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Wallet has insufficient funds");
1270+
}
12691271

12701272
// Shuffle recipient list
12711273
std::shuffle(vecSend.begin(), vecSend.end(), FastRandomContext());

0 commit comments

Comments
 (0)