mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-26 17:19:29 +01:00
refactor: move CreatedTransactionResult to types.h
So it can be used by external modules without requiring wallet.h dependency.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <util/result.h>
|
||||
#include <wallet/coinselection.h>
|
||||
#include <wallet/transaction.h>
|
||||
#include <wallet/types.h>
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
#include <map>
|
||||
@@ -186,17 +187,6 @@ util::Result<SelectionResult> 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<unsigned int> change_pos;
|
||||
|
||||
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) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Set a height-based locktime for new transactions (uses the height of the
|
||||
* current chain tip unless we are not synced with the current chain
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#ifndef BITCOIN_WALLET_TYPES_H
|
||||
#define BITCOIN_WALLET_TYPES_H
|
||||
|
||||
#include <type_traits>
|
||||
#include <policy/fees/block_policy_estimator.h>
|
||||
|
||||
namespace wallet {
|
||||
/**
|
||||
@@ -30,6 +30,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<unsigned int> change_pos;
|
||||
|
||||
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) {}
|
||||
};
|
||||
|
||||
} // namespace wallet
|
||||
|
||||
#endif // BITCOIN_WALLET_TYPES_H
|
||||
|
||||
Reference in New Issue
Block a user