Skip to content

Commit ac16e34

Browse files
committed
remove deprecated rpc check for create_bdb wallets
gui: re-enable legacy wallet creation descriptor wallet option in GUI unchecked by default
1 parent 8806605 commit ac16e34

8 files changed

Lines changed: 61 additions & 80 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ option(BUILD_DAEMON "Build elementsd executable." ON)
9494
option(BUILD_GUI "Build elements-qt executable." OFF)
9595
option(BUILD_CLI "Build elements-cli executable." ON)
9696

97-
option(BUILD_TESTS "Build test_bitcoin executable." ON)
97+
option(BUILD_TESTS "Build test_elements executable." ON)
9898
option(BUILD_TX "Build elements-tx executable." ${BUILD_TESTS})
9999
option(BUILD_UTIL "Build elements-util executable." ${BUILD_TESTS})
100100

@@ -670,7 +670,7 @@ message(" USDT tracing ........................ ${WITH_USDT}")
670670
message(" QR code (GUI) ....................... ${WITH_QRENCODE}")
671671
message(" DBus (GUI, Linux only) .............. ${WITH_DBUS}")
672672
message("Tests:")
673-
message(" test_bitcoin ........................ ${BUILD_TESTS}")
673+
message(" test_elements ........................ ${BUILD_TESTS}")
674674
message(" test_elements-qt .................... ${BUILD_GUI_TESTS}")
675675
message(" bench_bitcoin ....................... ${BUILD_BENCH}")
676676
message(" fuzz binary ......................... ${BUILD_FUZZ_BINARY}")

src/qt/bitcoingui.cpp

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
111111
{
112112
/** Create wallet frame and make it the central widget */
113113
walletFrame = new WalletFrame(_platformStyle, this);
114-
connect(walletFrame, &WalletFrame::createWalletButtonClicked, this, &BitcoinGUI::createWallet);
114+
connect(walletFrame, &WalletFrame::createWalletButtonClicked, [this] {
115+
auto activity = new CreateWalletActivity(getWalletController(), this);
116+
activity->create();
117+
});
115118
connect(walletFrame, &WalletFrame::message, [this](const QString& title, const QString& message, unsigned int style) {
116119
this->message(title, message, style);
117120
});
@@ -448,7 +451,12 @@ void BitcoinGUI::createActions()
448451
connect(m_close_wallet_action, &QAction::triggered, [this] {
449452
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);
450453
});
451-
connect(m_create_wallet_action, &QAction::triggered, this, &BitcoinGUI::createWallet);
454+
connect(m_create_wallet_action, &QAction::triggered, [this] {
455+
auto activity = new CreateWalletActivity(m_wallet_controller, this);
456+
connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet);
457+
connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet);
458+
activity->create();
459+
});
452460
connect(m_close_all_wallets_action, &QAction::triggered, [this] {
453461
m_wallet_controller->closeAllWallets(this);
454462
});
@@ -1198,21 +1206,6 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
11981206
progressBar->setToolTip(tooltip);
11991207
}
12001208

1201-
void BitcoinGUI::createWallet()
1202-
{
1203-
#ifdef ENABLE_WALLET
1204-
#ifndef USE_SQLITE
1205-
// Compiled without sqlite support (required for descriptor wallets)
1206-
message(tr("Error creating wallet"), tr("Cannot create new wallet, the software was compiled without sqlite support (required for descriptor wallets)"), CClientUIInterface::MSG_ERROR);
1207-
return;
1208-
#endif // USE_SQLITE
1209-
auto activity = new CreateWalletActivity(getWalletController(), this);
1210-
connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet);
1211-
connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet);
1212-
activity->create();
1213-
#endif // ENABLE_WALLET
1214-
}
1215-
12161209
void BitcoinGUI::message(const QString& title, QString message, unsigned int style, bool* ret, const QString& detailed_message)
12171210
{
12181211
// Default title. On macOS, the window title is ignored (as required by the macOS Guidelines).

src/qt/bitcoingui.h

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

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

src/qt/createwalletdialog.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
4848
ui->encrypt_wallet_checkbox->setEnabled(!checked);
4949
ui->blank_wallet_checkbox->setEnabled(!checked);
5050
ui->disable_privkeys_checkbox->setEnabled(!checked);
51+
ui->descriptor_checkbox->setEnabled(!checked);
5152

5253
// The external signer checkbox is only enabled when a device is detected.
5354
// In that case it is checked by default. Toggling it restores the other
5455
// options to their default.
56+
ui->descriptor_checkbox->setChecked(checked);
5557
ui->encrypt_wallet_checkbox->setChecked(false);
5658
ui->disable_privkeys_checkbox->setChecked(checked);
5759
ui->blank_wallet_checkbox->setChecked(false);
@@ -83,6 +85,24 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
8385
}
8486
});
8587

88+
#ifndef USE_SQLITE
89+
ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)"));
90+
ui->descriptor_checkbox->setEnabled(false);
91+
ui->descriptor_checkbox->setChecked(false);
92+
ui->external_signer_checkbox->setEnabled(false);
93+
ui->external_signer_checkbox->setChecked(false);
94+
#endif
95+
96+
#ifndef USE_BDB
97+
ui->descriptor_checkbox->setEnabled(false);
98+
ui->descriptor_checkbox->setChecked(true);
99+
#endif
100+
101+
#if defined(USE_SQLITE) && defined(USE_BDB)
102+
// Both wallet types available: default to legacy (unchecked = legacy)
103+
ui->descriptor_checkbox->setChecked(false);
104+
#endif
105+
86106
#ifndef ENABLE_EXTERNAL_SIGNER
87107
//: "External signing" means using devices such as hardware wallets.
88108
ui->external_signer_checkbox->setToolTip(tr("Compiled without external signing support (required for external signing)"));
@@ -138,6 +158,11 @@ bool CreateWalletDialog::isMakeBlankWalletChecked() const
138158
return ui->blank_wallet_checkbox->isChecked();
139159
}
140160

161+
bool CreateWalletDialog::isDescriptorWalletChecked() const
162+
{
163+
return ui->descriptor_checkbox->isChecked();
164+
}
165+
141166
bool CreateWalletDialog::isExternalSignerChecked() const
142167
{
143168
return ui->external_signer_checkbox->isChecked();

src/qt/createwalletdialog.h

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

4041
private:

src/qt/forms/createwalletdialog.ui

Lines changed: 16 additions & 56 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>371</width>
10-
<height>298</height>
9+
<width>364</width>
10+
<height>249</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -17,48 +17,6 @@
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>
6220
<item>
6321
<layout class="QHBoxLayout" name="horizontalLayout">
6422
<item>
@@ -117,19 +75,7 @@
11775
<property name="title">
11876
<string>Advanced Options</string>
11977
</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>
12978
<layout class="QVBoxLayout" name="verticalLayout_groupbox">
130-
<property name="spacing">
131-
<number>9</number>
132-
</property>
13379
<item>
13480
<widget class="QCheckBox" name="disable_privkeys_checkbox">
13581
<property name="enabled">
@@ -153,6 +99,19 @@
15399
</property>
154100
</widget>
155101
</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>false</bool>
112+
</property>
113+
</widget>
114+
</item>
156115
<item>
157116
<widget class="QCheckBox" name="external_signer_checkbox">
158117
<property name="toolTip">
@@ -196,6 +155,7 @@
196155
<tabstop>encrypt_wallet_checkbox</tabstop>
197156
<tabstop>disable_privkeys_checkbox</tabstop>
198157
<tabstop>blank_wallet_checkbox</tabstop>
158+
<tabstop>descriptor_checkbox</tabstop>
199159
<tabstop>external_signer_checkbox</tabstop>
200160
</tabstops>
201161
<resources/>

src/qt/walletcontroller.cpp

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

256256
std::string name = m_create_wallet_dialog->walletName().toStdString();
257257
uint64_t flags = 0;
258-
// Enable descriptors by default.
259-
flags |= WALLET_FLAG_DESCRIPTORS;
260258
if (m_create_wallet_dialog->isDisablePrivateKeysChecked()) {
261259
flags |= WALLET_FLAG_DISABLE_PRIVATE_KEYS;
262260
}
263261
if (m_create_wallet_dialog->isMakeBlankWalletChecked()) {
264262
flags |= WALLET_FLAG_BLANK_WALLET;
265263
}
264+
if (m_create_wallet_dialog->isDescriptorWalletChecked()) {
265+
flags |= WALLET_FLAG_DESCRIPTORS;
266+
}
266267
if (m_create_wallet_dialog->isExternalSignerChecked()) {
267268
flags |= WALLET_FLAG_EXTERNAL_SIGNER;
268269
}

src/wallet/rpc/wallet.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,15 @@ static RPCHelpMan createwallet()
416416
throw JSONRPCError(RPC_WALLET_ERROR, "Compiled without sqlite support (required for descriptor wallets)");
417417
#endif
418418
flags |= WALLET_FLAG_DESCRIPTORS;
419-
} else {
419+
}
420+
/* ELEMENTS: Remove the IsDeprecatedRPCEnabled("create_bdb") check so descriptors=false always works without a runtime flag
421+
else {
420422
if (!context.chain->rpcEnableDeprecated("create_bdb")) {
421423
throw JSONRPCError(RPC_WALLET_ERROR, "BDB wallet creation is deprecated and will be removed in a future release."
422424
" In this release it can be re-enabled temporarily with the -deprecatedrpc=create_bdb setting.");
423425
}
424426
}
427+
*/
425428
if (!request.params[7].isNull() && request.params[7].get_bool()) {
426429
#ifdef ENABLE_EXTERNAL_SIGNER
427430
flags |= WALLET_FLAG_EXTERNAL_SIGNER;

0 commit comments

Comments
 (0)