From b1535fb7218e73b5346bfb3d5ce3c32dc66d887d Mon Sep 17 00:00:00 2001 From: furszy Date: Thu, 21 Mar 2024 17:57:19 -0300 Subject: [PATCH] refactor: move CreatedTransactionResult to types.h So it can be used by external modules without requiring wallet.h dependency. --- src/wallet/spend.h | 12 +----------- src/wallet/types.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/wallet/spend.h b/src/wallet/spend.h index 62a7b4e4c89..f6d0a193bd4 100644 --- a/src/wallet/spend.h +++ b/src/wallet/spend.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -202,17 +203,6 @@ util::Result SelectCoins(const CWallet& wallet, CoinsResult& av const CAmount& nTargetValue, const CCoinControl& coin_control, const CoinSelectionParams& coin_selection_params) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet); -struct CreatedTransactionResult -{ - CTransactionRef tx; - CAmount fee; - FeeCalculation fee_calc; - std::optional change_pos; - - CreatedTransactionResult(CTransactionRef _tx, CAmount _fee, std::optional _change_pos, const FeeCalculation& _fee_calc) - : tx(_tx), fee(_fee), fee_calc(_fee_calc), change_pos(_change_pos) {} -}; - /** * Create a new transaction paying the recipients with a set of coins * selected by SelectCoins(); Also create the change output, when needed diff --git a/src/wallet/types.h b/src/wallet/types.h index 6198f1ae330..2e1390e7be7 100644 --- a/src/wallet/types.h +++ b/src/wallet/types.h @@ -13,6 +13,8 @@ #ifndef BITCOIN_WALLET_TYPES_H #define BITCOIN_WALLET_TYPES_H +#include + #include namespace wallet { @@ -62,6 +64,18 @@ enum class AddressPurpose { SEND, REFUND, //!< Never set in current code may be present in older wallet databases }; + +struct CreatedTransactionResult +{ + CTransactionRef tx; + CAmount fee; + FeeCalculation fee_calc; + std::optional change_pos; + + CreatedTransactionResult(CTransactionRef _tx, CAmount _fee, std::optional _change_pos, const FeeCalculation& _fee_calc) + : tx(_tx), fee(_fee), fee_calc(_fee_calc), change_pos(_change_pos) {} +}; + } // namespace wallet #endif // BITCOIN_WALLET_TYPES_H