Skip to content

Commit 6d59564

Browse files
committed
refactor: move CreatedTransactionResult to an util file
1 parent 355199c commit 6d59564

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

src/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ BITCOIN_CORE_H = \
357357
wallet/sqlite.h \
358358
wallet/transaction.h \
359359
wallet/types.h \
360+
wallet/util_spend.h \
360361
wallet/wallet.h \
361362
wallet/walletdb.h \
362363
wallet/wallettool.h \

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/util_spend.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/util_spend.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) 2024-present The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
4+
5+
#ifndef BITCOIN_WALLET_UTIL_SPEND_H
6+
#define BITCOIN_WALLET_UTIL_SPEND_H
7+
8+
#include <policy/fees.h>
9+
#include <wallet/transaction.h>
10+
11+
#include <optional>
12+
13+
struct CreatedTransactionResult
14+
{
15+
CTransactionRef tx;
16+
CAmount fee;
17+
FeeCalculation fee_calc;
18+
std::optional<unsigned int> change_pos;
19+
20+
CreatedTransactionResult(CTransactionRef _tx, CAmount _fee, std::optional<unsigned int> _change_pos, const FeeCalculation& _fee_calc)
21+
: tx(_tx), fee(_fee), fee_calc(_fee_calc), change_pos(_change_pos) {}
22+
};
23+
24+
#endif // BITCOIN_WALLET_UTIL_SPEND_H

0 commit comments

Comments
 (0)