aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpc
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2022-06-01 14:32:26 -0400
committerAndrew Chow <github@achow101.com>2023-12-08 17:12:19 -0500
commit758501b71391136c33b525b1a0109b990d4f463e (patch)
tree37c037c7ab72a684693bc1576b81595e4e4fedf8 /src/wallet/rpc
parent2d39db7aa128a948b6ad11242591ef26a342f5b1 (diff)
downloadbitcoin-758501b71391136c33b525b1a0109b990d4f463e.tar.xz
wallet: use optional for change position as an optional in CreateTransaction
Instead of making -1 a magic number meaning no change or random change position, use an optional to have that meaning.
Diffstat (limited to 'src/wallet/rpc')
-rw-r--r--src/wallet/rpc/spend.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp
index e7884af8b0..7cde644d9b 100644
--- a/src/wallet/rpc/spend.cpp
+++ b/src/wallet/rpc/spend.cpp
@@ -155,8 +155,7 @@ UniValue SendMoney(CWallet& wallet, const CCoinControl &coin_control, std::vecto
std::shuffle(recipients.begin(), recipients.end(), FastRandomContext());
// Send
- constexpr int RANDOM_CHANGE_POSITION = -1;
- auto res = CreateTransaction(wallet, recipients, RANDOM_CHANGE_POSITION, coin_control, true);
+ auto res = CreateTransaction(wallet, recipients, std::nullopt, coin_control, true);
if (!res) {
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, util::ErrorString(res).original);
}