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.
This commit is contained in:
Andrew Chow
2022-06-01 14:32:26 -04:00
committed by Andrew Chow
parent 2d39db7aa1
commit 758501b713
7 changed files with 28 additions and 36 deletions

View File

@@ -558,8 +558,7 @@ public:
CTransactionRef tx;
CCoinControl dummy;
{
constexpr int RANDOM_CHANGE_POSITION = -1;
auto res = CreateTransaction(*wallet, {recipient}, RANDOM_CHANGE_POSITION, dummy);
auto res = CreateTransaction(*wallet, {recipient}, std::nullopt, dummy);
BOOST_CHECK(res);
tx = res->tx;
}