Skip to content

Commit b1535fb

Browse files
committed
refactor: move CreatedTransactionResult to types.h
So it can be used by external modules without requiring wallet.h dependency.
1 parent 355199c commit b1535fb

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/wallet/spend.h

+1-11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <util/result.h>
1111
#include <wallet/coinselection.h>
1212
#include <wallet/transaction.h>
13+
#include <wallet/types.h>
1314
#include <wallet/wallet.h>
1415

1516
#include <optional>
@@ -202,17 +203,6 @@ util::Result<SelectionResult> SelectCoins(const CWallet& wallet, CoinsResult& av
202203
const CAmount& nTargetValue, const CCoinControl& coin_control,
203204
const CoinSelectionParams& coin_selection_params) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
204205

205-
struct CreatedTransactionResult
206-
{
207-
CTransactionRef tx;
208-
CAmount fee;
209-
FeeCalculation fee_calc;
210-
std::optional<unsigned int> change_pos;
211-
212-
CreatedTransactionResult(CTransactionRef _tx, CAmount _fee, std::optional<unsigned int> _change_pos, const FeeCalculation& _fee_calc)
213-
: tx(_tx), fee(_fee), fee_calc(_fee_calc), change_pos(_change_pos) {}
214-
};
215-
216206
/**
217207
* Create a new transaction paying the recipients with a set of coins
218208
* selected by SelectCoins(); Also create the change output, when needed

src/wallet/types.h

+14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#ifndef BITCOIN_WALLET_TYPES_H
1414
#define BITCOIN_WALLET_TYPES_H
1515

16+
#include <policy/fees.h>
17+
1618
#include <type_traits>
1719

1820
namespace wallet {
@@ -62,6 +64,18 @@ enum class AddressPurpose {
6264
SEND,
6365
REFUND, //!< Never set in current code may be present in older wallet databases
6466
};
67+
68+
struct CreatedTransactionResult
69+
{
70+
CTransactionRef tx;
71+
CAmount fee;
72+
FeeCalculation fee_calc;
73+
std::optional<unsigned int> change_pos;
74+
75+
CreatedTransactionResult(CTransactionRef _tx, CAmount _fee, std::optional<unsigned int> _change_pos, const FeeCalculation& _fee_calc)
76+
: tx(_tx), fee(_fee), fee_calc(_fee_calc), change_pos(_change_pos) {}
77+
};
78+
6579
} // namespace wallet
6680

6781
#endif // BITCOIN_WALLET_TYPES_H

0 commit comments

Comments
 (0)