aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/spend.h
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/spend.h
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/spend.h')
-rw-r--r--src/wallet/spend.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wallet/spend.h b/src/wallet/spend.h
index 407627b5f1..ccadbed1f5 100644
--- a/src/wallet/spend.h
+++ b/src/wallet/spend.h
@@ -207,9 +207,9 @@ struct CreatedTransactionResult
CTransactionRef tx;
CAmount fee;
FeeCalculation fee_calc;
- int change_pos;
+ std::optional<unsigned int> change_pos;
- CreatedTransactionResult(CTransactionRef _tx, CAmount _fee, int _change_pos, const FeeCalculation& _fee_calc)
+ CreatedTransactionResult(CTransactionRef _tx, CAmount _fee, std::optional<unsigned int> _change_pos, const FeeCalculation& _fee_calc)
: tx(_tx), fee(_fee), fee_calc(_fee_calc), change_pos(_change_pos) {}
};
@@ -218,7 +218,7 @@ struct CreatedTransactionResult
* selected by SelectCoins(); Also create the change output, when needed
* @note passing change_pos as -1 will result in setting a random position
*/
-util::Result<CreatedTransactionResult> CreateTransaction(CWallet& wallet, const std::vector<CRecipient>& vecSend, int change_pos, const CCoinControl& coin_control, bool sign = true);
+util::Result<CreatedTransactionResult> CreateTransaction(CWallet& wallet, const std::vector<CRecipient>& vecSend, std::optional<unsigned int> change_pos, const CCoinControl& coin_control, bool sign = true);
/**
* Insert additional inputs into the transaction by