Skip to content

Commit cc15522

Browse files
committed
wallet: set m_version in coin control to default value
In future commits we assume that coin_control.m_version has a value when making sure that we follow truc rules, so we should give it a default value of CTransaction::CURRENT_VERSION.
1 parent 2e96176 commit cc15522

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/wallet/coincontrol.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ class CCoinControl
109109
int m_max_depth = DEFAULT_MAX_DEPTH;
110110
//! SigningProvider that has pubkeys and scripts to do spend size estimation for external inputs
111111
FlatSigningProvider m_external_provider;
112+
//! Version
113+
uint32_t m_version = CTransaction::CURRENT_VERSION;
112114
//! Locktime
113115
std::optional<uint32_t> m_locktime;
114-
//! Version
115-
std::optional<uint32_t> m_version;
116116
//! Caps weight of resulting tx
117117
std::optional<int> m_max_tx_weight{std::nullopt};
118118

src/wallet/spend.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,9 +1032,7 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
10321032
FastRandomContext rng_fast;
10331033
CMutableTransaction txNew; // The resulting transaction that we make
10341034

1035-
if (coin_control.m_version) {
1036-
txNew.version = coin_control.m_version.value();
1037-
}
1035+
txNew.version = coin_control.m_version;
10381036

10391037
CoinSelectionParams coin_selection_params{rng_fast}; // Parameters for coin selection, init with dummy
10401038
coin_selection_params.m_avoid_partial_spends = coin_control.m_avoid_partial_spends;

0 commit comments

Comments
 (0)