Skip to content

Commit d2b8c5e

Browse files
committed
Merge #764: Remove legacy wallet creation
b442580 gui: remove legacy wallet creation (furszy) Pull request description: Fixes #763 Preventing users from creating a legacy wallet prior to its deprecation in the upcoming releases. Note: This is still available using the `createwallet` RPC command. Future Note: Would be nice to re-write this modal as a wizard. And improve the design. <details><summary> Pre-Changes Screenshot </summary> <img width="611" alt="Screenshot 2023-10-06 at 11 30 14" src="https://github.com/bitcoin-core/gui/assets/5377650/ca10c97d-46e8-4aed-82da-068f2afbe25c"> </details> <details><summary> Post-Changes Screenshot </summary> <img width="729" alt="Screenshot 2023-10-06 at 11 32 58" src="https://github.com/bitcoin-core/gui/assets/5377650/f6bdcb57-646a-43d8-86a7-476e3cca683f"> </details> ACKs for top commit: achow101: ACK b442580 hebasto: re-ACK b442580 pablomartin4btc: tACK b442580 Tree-SHA512: f5d26ffbb0962648b9edf273b325e89425a318e136df26a26acb21b88730fd7d6499c68a705680539dc1b40862fbf413a1e0c8572436a0cfc665e2d08a3cf97d
2 parents 38f4b0d + b442580 commit d2b8c5e

File tree

6 files changed

+77
-50
lines changed

6 files changed

+77
-50
lines changed

src/qt/bitcoingui.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
109109
{
110110
/** Create wallet frame and make it the central widget */
111111
walletFrame = new WalletFrame(_platformStyle, this);
112-
connect(walletFrame, &WalletFrame::createWalletButtonClicked, [this] {
113-
auto activity = new CreateWalletActivity(getWalletController(), this);
114-
activity->create();
115-
});
112+
connect(walletFrame, &WalletFrame::createWalletButtonClicked, this, &BitcoinGUI::createWallet);
116113
connect(walletFrame, &WalletFrame::message, [this](const QString& title, const QString& message, unsigned int style) {
117114
this->message(title, message, style);
118115
});
@@ -453,12 +450,7 @@ void BitcoinGUI::createActions()
453450
connect(m_close_wallet_action, &QAction::triggered, [this] {
454451
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);
455452
});
456-
connect(m_create_wallet_action, &QAction::triggered, [this] {
457-
auto activity = new CreateWalletActivity(m_wallet_controller, this);
458-
connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet);
459-
connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet);
460-
activity->create();
461-
});
453+
connect(m_create_wallet_action, &QAction::triggered, this, &BitcoinGUI::createWallet);
462454
connect(m_close_all_wallets_action, &QAction::triggered, [this] {
463455
m_wallet_controller->closeAllWallets(this);
464456
});
@@ -1191,6 +1183,21 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
11911183
progressBar->setToolTip(tooltip);
11921184
}
11931185

1186+
void BitcoinGUI::createWallet()
1187+
{
1188+
#ifdef ENABLE_WALLET
1189+
#ifndef USE_SQLITE
1190+
// Compiled without sqlite support (required for descriptor wallets)
1191+
message(tr("Error creating wallet"), tr("Cannot create new wallet, the software was compiled without sqlite support (required for descriptor wallets)"), CClientUIInterface::MSG_ERROR);
1192+
return;
1193+
#endif // USE_SQLITE
1194+
auto activity = new CreateWalletActivity(getWalletController(), this);
1195+
connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet);
1196+
connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet);
1197+
activity->create();
1198+
#endif // ENABLE_WALLET
1199+
}
1200+
11941201
void BitcoinGUI::message(const QString& title, QString message, unsigned int style, bool* ret, const QString& detailed_message)
11951202
{
11961203
// Default title. On macOS, the window title is ignored (as required by the macOS Guidelines).

src/qt/bitcoingui.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ public Q_SLOTS:
230230
void setNetworkActive(bool network_active);
231231
/** Set number of blocks and last block date shown in the UI */
232232
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state);
233+
/** Launch the wallet creation modal (no-op if wallet is not compiled) **/
234+
void createWallet();
233235

234236
/** Notify the user of an event from the core network or transaction handling code.
235237
@param[in] title the message box / notification title

src/qt/createwalletdialog.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
5050
ui->encrypt_wallet_checkbox->setEnabled(!checked);
5151
ui->blank_wallet_checkbox->setEnabled(!checked);
5252
ui->disable_privkeys_checkbox->setEnabled(!checked);
53-
ui->descriptor_checkbox->setEnabled(!checked);
5453

5554
// The external signer checkbox is only enabled when a device is detected.
5655
// In that case it is checked by default. Toggling it restores the other
5756
// options to their default.
58-
ui->descriptor_checkbox->setChecked(checked);
5957
ui->encrypt_wallet_checkbox->setChecked(false);
6058
ui->disable_privkeys_checkbox->setChecked(checked);
6159
ui->blank_wallet_checkbox->setChecked(false);
@@ -87,19 +85,6 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
8785
}
8886
});
8987

90-
#ifndef USE_SQLITE
91-
ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)"));
92-
ui->descriptor_checkbox->setEnabled(false);
93-
ui->descriptor_checkbox->setChecked(false);
94-
ui->external_signer_checkbox->setEnabled(false);
95-
ui->external_signer_checkbox->setChecked(false);
96-
#endif
97-
98-
#ifndef USE_BDB
99-
ui->descriptor_checkbox->setEnabled(false);
100-
ui->descriptor_checkbox->setChecked(true);
101-
#endif
102-
10388
#ifndef ENABLE_EXTERNAL_SIGNER
10489
//: "External signing" means using devices such as hardware wallets.
10590
ui->external_signer_checkbox->setToolTip(tr("Compiled without external signing support (required for external signing)"));
@@ -155,11 +140,6 @@ bool CreateWalletDialog::isMakeBlankWalletChecked() const
155140
return ui->blank_wallet_checkbox->isChecked();
156141
}
157142

158-
bool CreateWalletDialog::isDescriptorWalletChecked() const
159-
{
160-
return ui->descriptor_checkbox->isChecked();
161-
}
162-
163143
bool CreateWalletDialog::isExternalSignerChecked() const
164144
{
165145
return ui->external_signer_checkbox->isChecked();

src/qt/createwalletdialog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class CreateWalletDialog : public QDialog
3535
bool isEncryptWalletChecked() const;
3636
bool isDisablePrivateKeysChecked() const;
3737
bool isMakeBlankWalletChecked() const;
38-
bool isDescriptorWalletChecked() const;
3938
bool isExternalSignerChecked() const;
4039

4140
private:

src/qt/forms/createwalletdialog.ui

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>364</width>
10-
<height>249</height>
9+
<width>371</width>
10+
<height>298</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -17,6 +17,48 @@
1717
<bool>true</bool>
1818
</property>
1919
<layout class="QVBoxLayout" name="verticalLayout">
20+
<item>
21+
<widget class="QLabel" name="label_description">
22+
<property name="sizePolicy">
23+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
24+
<horstretch>0</horstretch>
25+
<verstretch>0</verstretch>
26+
</sizepolicy>
27+
</property>
28+
<property name="text">
29+
<string>You are one step away from creating your new wallet!</string>
30+
</property>
31+
<property name="alignment">
32+
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
33+
</property>
34+
<property name="wordWrap">
35+
<bool>false</bool>
36+
</property>
37+
</widget>
38+
</item>
39+
<item>
40+
<widget class="QLabel" name="label_subdescription">
41+
<property name="text">
42+
<string>Please provide a name and, if desired, enable any advanced options</string>
43+
</property>
44+
</widget>
45+
</item>
46+
<item>
47+
<spacer name="verticalSpacer">
48+
<property name="orientation">
49+
<enum>Qt::Vertical</enum>
50+
</property>
51+
<property name="sizeType">
52+
<enum>QSizePolicy::Fixed</enum>
53+
</property>
54+
<property name="sizeHint" stdset="0">
55+
<size>
56+
<width>20</width>
57+
<height>3</height>
58+
</size>
59+
</property>
60+
</spacer>
61+
</item>
2062
<item>
2163
<layout class="QHBoxLayout" name="horizontalLayout">
2264
<item>
@@ -75,7 +117,19 @@
75117
<property name="title">
76118
<string>Advanced Options</string>
77119
</property>
120+
<property name="alignment">
121+
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
122+
</property>
123+
<property name="flat">
124+
<bool>false</bool>
125+
</property>
126+
<property name="checkable">
127+
<bool>false</bool>
128+
</property>
78129
<layout class="QVBoxLayout" name="verticalLayout_groupbox">
130+
<property name="spacing">
131+
<number>9</number>
132+
</property>
79133
<item>
80134
<widget class="QCheckBox" name="disable_privkeys_checkbox">
81135
<property name="enabled">
@@ -99,19 +153,6 @@
99153
</property>
100154
</widget>
101155
</item>
102-
<item>
103-
<widget class="QCheckBox" name="descriptor_checkbox">
104-
<property name="toolTip">
105-
<string>Use descriptors for scriptPubKey management</string>
106-
</property>
107-
<property name="text">
108-
<string>Descriptor Wallet</string>
109-
</property>
110-
<property name="checked">
111-
<bool>true</bool>
112-
</property>
113-
</widget>
114-
</item>
115156
<item>
116157
<widget class="QCheckBox" name="external_signer_checkbox">
117158
<property name="toolTip">
@@ -155,7 +196,6 @@
155196
<tabstop>encrypt_wallet_checkbox</tabstop>
156197
<tabstop>disable_privkeys_checkbox</tabstop>
157198
<tabstop>blank_wallet_checkbox</tabstop>
158-
<tabstop>descriptor_checkbox</tabstop>
159199
<tabstop>external_signer_checkbox</tabstop>
160200
</tabstops>
161201
<resources/>

src/qt/walletcontroller.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,14 @@ void CreateWalletActivity::createWallet()
250250

251251
std::string name = m_create_wallet_dialog->walletName().toStdString();
252252
uint64_t flags = 0;
253+
// Enable descriptors by default.
254+
flags |= WALLET_FLAG_DESCRIPTORS;
253255
if (m_create_wallet_dialog->isDisablePrivateKeysChecked()) {
254256
flags |= WALLET_FLAG_DISABLE_PRIVATE_KEYS;
255257
}
256258
if (m_create_wallet_dialog->isMakeBlankWalletChecked()) {
257259
flags |= WALLET_FLAG_BLANK_WALLET;
258260
}
259-
if (m_create_wallet_dialog->isDescriptorWalletChecked()) {
260-
flags |= WALLET_FLAG_DESCRIPTORS;
261-
}
262261
if (m_create_wallet_dialog->isExternalSignerChecked()) {
263262
flags |= WALLET_FLAG_EXTERNAL_SIGNER;
264263
}

0 commit comments

Comments
 (0)