|
|
@ -1263,9 +1263,11 @@ static UniValue sendmany(const JSONRPCRequest& request)
|
|
|
|
EnsureWalletIsUnlocked(pwallet);
|
|
|
|
EnsureWalletIsUnlocked(pwallet);
|
|
|
|
|
|
|
|
|
|
|
|
// Check funds
|
|
|
|
// Check funds
|
|
|
|
CAmount nBalance = pwallet->GetLegacyBalance(ISMINE_SPENDABLE, nMinDepth, &strAccount);
|
|
|
|
if (IsDeprecatedRPCEnabled("accounts") && totalAmount > pwallet->GetLegacyBalance(ISMINE_SPENDABLE, nMinDepth, &strAccount)) {
|
|
|
|
if (totalAmount > nBalance)
|
|
|
|
|
|
|
|
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
|
|
|
|
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
|
|
|
|
|
|
|
|
} else if (!IsDeprecatedRPCEnabled("accounts") && totalAmount > pwallet->GetLegacyBalance(ISMINE_SPENDABLE, nMinDepth, nullptr)) {
|
|
|
|
|
|
|
|
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Wallet has insufficient funds");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Shuffle recipient list
|
|
|
|
// Shuffle recipient list
|
|
|
|
std::shuffle(vecSend.begin(), vecSend.end(), FastRandomContext());
|
|
|
|
std::shuffle(vecSend.begin(), vecSend.end(), FastRandomContext());
|
|
|
|