diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-06-01 14:32:26 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-12-08 17:12:19 -0500 |
commit | 758501b71391136c33b525b1a0109b990d4f463e (patch) | |
tree | 37c037c7ab72a684693bc1576b81595e4e4fedf8 /src/wallet/rpc | |
parent | 2d39db7aa128a948b6ad11242591ef26a342f5b1 (diff) | |
download | bitcoin-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.cpp | 3 |
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); } |