0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-10 10:52:31 -05:00

Merge bitcoin/bitcoin#21714: refactor: Drop CCoinControl::SetNull

c5a470eee1 refactor: Drop CCoinControl::SetNull (João Barbosa)

Pull request description:

  The only external call to `SetNull` is changed as follow

  ```diff
  - m_coin_control->SetNull();
  + m_coin_control = std::make_unique<CCoinControl>();
  ```

ACKs for top commit:
  theStack:
    Code-Review ACK c5a470eee1
  MarcoFalke:
    review ACK c5a470eee1 🍤

Tree-SHA512: 2588828720cdcf405fc4fb06f2aa17ad4eef2a645e12d820311006127e732258dd084993f17f23742f8e7f782e18289a6199dcec3690efc9b92458f90b816a8f
This commit is contained in:
MarcoFalke 2021-04-26 09:20:39 +02:00
commit 74a960a220
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
3 changed files with 13 additions and 31 deletions

View file

@ -839,8 +839,9 @@ void SendCoinsDialog::coinControlFeatureChanged(bool checked)
{ {
ui->frameCoinControl->setVisible(checked); ui->frameCoinControl->setVisible(checked);
if (!checked && model) // coin control features disabled if (!checked && model) { // coin control features disabled
m_coin_control->SetNull(); m_coin_control = std::make_unique<CCoinControl>();
}
coinControlUpdateLabels(); coinControlUpdateLabels();
} }

View file

@ -6,21 +6,7 @@
#include <util/system.h> #include <util/system.h>
void CCoinControl::SetNull() CCoinControl::CCoinControl()
{ {
destChange = CNoDestination();
m_change_type.reset();
m_add_inputs = true;
fAllowOtherInputs = false;
fAllowWatchOnly = false;
m_avoid_partial_spends = gArgs.GetBoolArg("-avoidpartialspends", DEFAULT_AVOIDPARTIALSPENDS); m_avoid_partial_spends = gArgs.GetBoolArg("-avoidpartialspends", DEFAULT_AVOIDPARTIALSPENDS);
m_avoid_address_reuse = false;
setSelected.clear();
m_feerate.reset();
fOverrideFeeRate = false;
m_confirm_target.reset();
m_signal_bip125_rbf.reset();
m_fee_mode = FeeEstimateMode::UNSET;
m_min_depth = DEFAULT_MIN_DEPTH;
m_max_depth = DEFAULT_MAX_DEPTH;
} }

View file

@ -24,17 +24,17 @@ class CCoinControl
{ {
public: public:
//! Custom change destination, if not set an address is generated //! Custom change destination, if not set an address is generated
CTxDestination destChange; CTxDestination destChange = CNoDestination();
//! Override the default change type if set, ignored if destChange is set //! Override the default change type if set, ignored if destChange is set
std::optional<OutputType> m_change_type; std::optional<OutputType> m_change_type;
//! If false, only selected inputs are used //! If false, only selected inputs are used
bool m_add_inputs; bool m_add_inputs = true;
//! If false, allows unselected inputs, but requires all selected inputs be used //! If false, allows unselected inputs, but requires all selected inputs be used
bool fAllowOtherInputs; bool fAllowOtherInputs = false;
//! Includes watch only addresses which are solvable //! Includes watch only addresses which are solvable
bool fAllowWatchOnly; bool fAllowWatchOnly = false;
//! Override automatic min/max checks on fee, m_feerate must be set if true //! Override automatic min/max checks on fee, m_feerate must be set if true
bool fOverrideFeeRate; bool fOverrideFeeRate = false;
//! Override the wallet's m_pay_tx_fee if set //! Override the wallet's m_pay_tx_fee if set
std::optional<CFeeRate> m_feerate; std::optional<CFeeRate> m_feerate;
//! Override the default confirmation target if set //! Override the default confirmation target if set
@ -42,22 +42,17 @@ public:
//! Override the wallet's m_signal_rbf if set //! Override the wallet's m_signal_rbf if set
std::optional<bool> m_signal_bip125_rbf; std::optional<bool> m_signal_bip125_rbf;
//! Avoid partial use of funds sent to a given address //! Avoid partial use of funds sent to a given address
bool m_avoid_partial_spends; bool m_avoid_partial_spends = DEFAULT_AVOIDPARTIALSPENDS;
//! Forbids inclusion of dirty (previously used) addresses //! Forbids inclusion of dirty (previously used) addresses
bool m_avoid_address_reuse; bool m_avoid_address_reuse = false;
//! Fee estimation mode to control arguments to estimateSmartFee //! Fee estimation mode to control arguments to estimateSmartFee
FeeEstimateMode m_fee_mode; FeeEstimateMode m_fee_mode = FeeEstimateMode::UNSET;
//! Minimum chain depth value for coin availability //! Minimum chain depth value for coin availability
int m_min_depth = DEFAULT_MIN_DEPTH; int m_min_depth = DEFAULT_MIN_DEPTH;
//! Maximum chain depth value for coin availability //! Maximum chain depth value for coin availability
int m_max_depth = DEFAULT_MAX_DEPTH; int m_max_depth = DEFAULT_MAX_DEPTH;
CCoinControl() CCoinControl();
{
SetNull();
}
void SetNull();
bool HasSelected() const bool HasSelected() const
{ {