refactor: move CreatedTransactionResult to types.h

So it can be used by external modules without requiring
wallet.h dependency.
This commit is contained in:
furszy
2024-03-21 17:57:19 -03:00
parent 45372175c3
commit e2c3ec9bf4
2 changed files with 14 additions and 12 deletions

View File

@@ -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

View File

@@ -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