Skip to content

Commit c5a470e

Browse files
committed
refactor: Drop CCoinControl::SetNull
1 parent 585cbe2 commit c5a470e

File tree

3 files changed

+13
-31
lines changed

3 files changed

+13
-31
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,9 @@ void SendCoinsDialog::coinControlFeatureChanged(bool checked)
839839
{
840840
ui->frameCoinControl->setVisible(checked);
841841

842-
if (!checked && model) // coin control features disabled
843-
m_coin_control->SetNull();
842+
if (!checked && model) { // coin control features disabled
843+
m_coin_control = std::make_unique<CCoinControl>();
844+
}
844845

845846
coinControlUpdateLabels();
846847
}

src/wallet/coincontrol.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,7 @@
66

77
#include <util/system.h>
88

9-
void CCoinControl::SetNull()
9+
CCoinControl::CCoinControl()
1010
{
11-
destChange = CNoDestination();
12-
m_change_type.reset();
13-
m_add_inputs = true;
14-
fAllowOtherInputs = false;
15-
fAllowWatchOnly = false;
1611
m_avoid_partial_spends = gArgs.GetBoolArg("-avoidpartialspends", DEFAULT_AVOIDPARTIALSPENDS);
17-
m_avoid_address_reuse = false;
18-
setSelected.clear();
19-
m_feerate.reset();
20-
fOverrideFeeRate = false;
21-
m_confirm_target.reset();
22-
m_signal_bip125_rbf.reset();
23-
m_fee_mode = FeeEstimateMode::UNSET;
24-
m_min_depth = DEFAULT_MIN_DEPTH;
25-
m_max_depth = DEFAULT_MAX_DEPTH;
2612
}

src/wallet/coincontrol.h

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,35 @@ class CCoinControl
2424
{
2525
public:
2626
//! Custom change destination, if not set an address is generated
27-
CTxDestination destChange;
27+
CTxDestination destChange = CNoDestination();
2828
//! Override the default change type if set, ignored if destChange is set
2929
std::optional<OutputType> m_change_type;
3030
//! If false, only selected inputs are used
31-
bool m_add_inputs;
31+
bool m_add_inputs = true;
3232
//! If false, allows unselected inputs, but requires all selected inputs be used
33-
bool fAllowOtherInputs;
33+
bool fAllowOtherInputs = false;
3434
//! Includes watch only addresses which are solvable
35-
bool fAllowWatchOnly;
35+
bool fAllowWatchOnly = false;
3636
//! Override automatic min/max checks on fee, m_feerate must be set if true
37-
bool fOverrideFeeRate;
37+
bool fOverrideFeeRate = false;
3838
//! Override the wallet's m_pay_tx_fee if set
3939
std::optional<CFeeRate> m_feerate;
4040
//! Override the default confirmation target if set
4141
std::optional<unsigned int> m_confirm_target;
4242
//! Override the wallet's m_signal_rbf if set
4343
std::optional<bool> m_signal_bip125_rbf;
4444
//! Avoid partial use of funds sent to a given address
45-
bool m_avoid_partial_spends;
45+
bool m_avoid_partial_spends = DEFAULT_AVOIDPARTIALSPENDS;
4646
//! Forbids inclusion of dirty (previously used) addresses
47-
bool m_avoid_address_reuse;
47+
bool m_avoid_address_reuse = false;
4848
//! Fee estimation mode to control arguments to estimateSmartFee
49-
FeeEstimateMode m_fee_mode;
49+
FeeEstimateMode m_fee_mode = FeeEstimateMode::UNSET;
5050
//! Minimum chain depth value for coin availability
5151
int m_min_depth = DEFAULT_MIN_DEPTH;
5252
//! Maximum chain depth value for coin availability
5353
int m_max_depth = DEFAULT_MAX_DEPTH;
5454

55-
CCoinControl()
56-
{
57-
SetNull();
58-
}
59-
60-
void SetNull();
55+
CCoinControl();
6156

6257
bool HasSelected() const
6358
{

0 commit comments

Comments
 (0)