diff --git a/doc/release-notes.md b/doc/release-notes.md index b183ee0a594..973fd3c84cf 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -73,6 +73,7 @@ RPC changes - Wallet `listreceivedbylabel`, `listreceivedbyaccount` and `listunspent` RPCs add `label` fields to returned JSON objects that previously only had `account` fields. +- `sendmany` now shuffles outputs to improve privacy, so any previously expected behavior with regards to output ordering can no longer be relied upon. External wallet files --------------------- diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index dbc48834ffd..365dedfceb2 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1145,6 +1145,9 @@ UniValue sendmany(const JSONRPCRequest& request) if (totalAmount > nBalance) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds"); + // Shuffle recipient list + std::shuffle(vecSend.begin(), vecSend.end(), FastRandomContext()); + // Send CReserveKey keyChange(pwallet); CAmount nFeeRequired = 0;