Skip to content

Commit 9a05b45

Browse files
committed
Merge bitcoin/bitcoin#32438: refactor: Removals after bdb removal
fa061bf Remove create options from wallet tool (MarcoFalke) fa2125e Remove unused IsSingleKey (MarcoFalke) fab5e2a doc: Remove note about bdb wallets (MarcoFalke) eeeef88 doc: fix typo in abortrescan rpc (MarcoFalke) fa7e5c1 Remove unused LegacyDataSPKM::DeleteRecords() (MarcoFalke) ffff949 remove NotifyWatchonlyChanged (MarcoFalke) fa62a01 remove dead flush() (MarcoFalke) fa5f3e6 vcpkg: Remove bdb (MarcoFalke) Pull request description: This deletes some dead code ACKs for top commit: Sjors: ACK fa061bf if CI is also happy rkrux: utACK fa061bf Tree-SHA512: 6c0b0705caa4ad024e6b921bd7f65aaa055d1f12f7884cd61823cbf0c32e46697ddbdaa209ab449d6a1df9761ce5d53763e25f26e4c36ce4c685b7524f5a3dd9
2 parents b070ce1 + fa061bf commit 9a05b45

20 files changed

+6
-110
lines changed

doc/managing-wallets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ In the GUI, there is no specific menu item to unlock the wallet. When the user s
8282

8383
To backup the wallet, the `backupwallet` RPC or the `Backup Wallet` GUI menu item must be used to ensure the file is in a safe state when the copy is made.
8484

85-
In the RPC, the destination parameter must include the name of the file. Otherwise, the command will return an error message like "Error: Wallet backup failed!" for descriptor wallets. If it is a legacy wallet, it will be copied and a file will be created with the default file name `wallet.dat`.
85+
In the RPC, the destination parameter must include the name of the file. Otherwise, the command will return an error message like "Error: Wallet backup failed!".
8686

8787
```
8888
$ bitcoin-cli -rpcwallet="wallet-01" backupwallet /home/node01/Backups/backup-01.dat

src/bitcoin-wallet.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ static void SetupWalletToolArgs(ArgsManager& argsman)
3838
argsman.AddArg("-wallet=<wallet-name>", "Specify wallet name", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::OPTIONS);
3939
argsman.AddArg("-dumpfile=<file name>", "When used with 'dump', writes out the records to this file. When used with 'createfromdump', loads the records into a new wallet.", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::OPTIONS);
4040
argsman.AddArg("-debug=<category>", "Output debugging information (default: 0).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
41-
argsman.AddArg("-descriptors", "Create descriptors wallet. Only for 'create'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
42-
argsman.AddArg("-legacy", "Create legacy wallet. Only for 'create'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
4341
argsman.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -debug is true, 0 otherwise).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
4442

4543
argsman.AddCommand("info", "Get wallet info");
46-
argsman.AddCommand("create", "Create new wallet file");
44+
argsman.AddCommand("create", "Create a new descriptor wallet file");
4745
argsman.AddCommand("dump", "Print out all of the wallet key-value records");
4846
argsman.AddCommand("createfromdump", "Create new wallet file from dumped records");
4947
}

src/init.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,6 @@ void Shutdown(NodeContext& node)
298298
StopREST();
299299
StopRPC();
300300
StopHTTPServer();
301-
for (const auto& client : node.chain_clients) {
302-
client->flush();
303-
}
304301
StopMapPort();
305302

306303
// Because these depend on each-other, we make sure that neither can be

src/interfaces/chain.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,6 @@ class ChainClient
407407
//! Start client execution and provide a scheduler.
408408
virtual void start(CScheduler& scheduler) = 0;
409409

410-
//! Save state to disk.
411-
virtual void flush() = 0;
412-
413410
//! Shut down client.
414411
virtual void stop() = 0;
415412

src/interfaces/wallet.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,6 @@ class Wallet
303303
using TransactionChangedFn = std::function<void(const uint256& txid, ChangeType status)>;
304304
virtual std::unique_ptr<Handler> handleTransactionChanged(TransactionChangedFn fn) = 0;
305305

306-
//! Register handler for watchonly changed messages.
307-
using WatchOnlyChangedFn = std::function<void(bool have_watch_only)>;
308-
virtual std::unique_ptr<Handler> handleWatchOnlyChanged(WatchOnlyChangedFn fn) = 0;
309-
310306
//! Register handler for keypool changed messages.
311307
using CanGetAddressesChangedFn = std::function<void()>;
312308
virtual std::unique_ptr<Handler> handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) = 0;

src/qt/transactionview.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,6 @@ void TransactionView::setModel(WalletModel *_model)
243243

244244
// hide column Watch-only
245245
updateWatchOnlyColumn(false);
246-
247-
// Watch-only signal
248-
connect(_model, &WalletModel::notifyWatchonlyChanged, this, &TransactionView::updateWatchOnlyColumn);
249246
}
250247
}
251248

src/qt/walletmodel.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ WalletModel::WalletModel(std::unique_ptr<interfaces::Wallet> wallet, ClientModel
4545
optionsModel(client_model.getOptionsModel()),
4646
timer(new QTimer(this))
4747
{
48-
fHaveWatchOnly = false;
4948
addressTableModel = new AddressTableModel(this);
5049
transactionTableModel = new TransactionTableModel(platformStyle, this);
5150
recentRequestsTableModel = new RecentRequestsTableModel(this);
@@ -141,12 +140,6 @@ void WalletModel::updateAddressBook(const QString &address, const QString &label
141140
addressTableModel->updateEntry(address, label, isMine, purpose, status);
142141
}
143142

144-
void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly)
145-
{
146-
fHaveWatchOnly = fHaveWatchonly;
147-
Q_EMIT notifyWatchonlyChanged(fHaveWatchonly);
148-
}
149-
150143
bool WalletModel::validateAddress(const QString& address) const
151144
{
152145
return IsValidDestinationString(address.toStdString());
@@ -405,13 +398,6 @@ static void ShowProgress(WalletModel *walletmodel, const std::string &title, int
405398
assert(invoked);
406399
}
407400

408-
static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly)
409-
{
410-
bool invoked = QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag", Qt::QueuedConnection,
411-
Q_ARG(bool, fHaveWatchonly));
412-
assert(invoked);
413-
}
414-
415401
static void NotifyCanGetAddressesChanged(WalletModel* walletmodel)
416402
{
417403
bool invoked = QMetaObject::invokeMethod(walletmodel, "canGetAddressesChanged");
@@ -426,7 +412,6 @@ void WalletModel::subscribeToCoreSignals()
426412
m_handler_address_book_changed = m_wallet->handleAddressBookChanged(std::bind(NotifyAddressBookChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5));
427413
m_handler_transaction_changed = m_wallet->handleTransactionChanged(std::bind(NotifyTransactionChanged, this, std::placeholders::_1, std::placeholders::_2));
428414
m_handler_show_progress = m_wallet->handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2));
429-
m_handler_watch_only_changed = m_wallet->handleWatchOnlyChanged(std::bind(NotifyWatchonlyChanged, this, std::placeholders::_1));
430415
m_handler_can_get_addrs_changed = m_wallet->handleCanGetAddressesChanged(std::bind(NotifyCanGetAddressesChanged, this));
431416
}
432417

@@ -438,7 +423,6 @@ void WalletModel::unsubscribeFromCoreSignals()
438423
m_handler_address_book_changed->disconnect();
439424
m_handler_transaction_changed->disconnect();
440425
m_handler_show_progress->disconnect();
441-
m_handler_watch_only_changed->disconnect();
442426
m_handler_can_get_addrs_changed->disconnect();
443427
}
444428

src/qt/walletmodel.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,10 @@ class WalletModel : public QObject
162162
std::unique_ptr<interfaces::Handler> m_handler_address_book_changed;
163163
std::unique_ptr<interfaces::Handler> m_handler_transaction_changed;
164164
std::unique_ptr<interfaces::Handler> m_handler_show_progress;
165-
std::unique_ptr<interfaces::Handler> m_handler_watch_only_changed;
166165
std::unique_ptr<interfaces::Handler> m_handler_can_get_addrs_changed;
167166
ClientModel* m_client_model;
168167
interfaces::Node& m_node;
169168

170-
bool fHaveWatchOnly;
171169
bool fForceCheckBalanceChanged{false};
172170

173171
// Wallet has an options model for wallet-specific options
@@ -211,9 +209,6 @@ class WalletModel : public QObject
211209
// Show progress dialog e.g. for rescan
212210
void showProgress(const QString &title, int nProgress);
213211

214-
// Watch-only address added
215-
void notifyWatchonlyChanged(bool fHaveWatchonly);
216-
217212
// Signal that wallet is about to be removed
218213
void unload();
219214

@@ -232,8 +227,6 @@ public Q_SLOTS:
232227
void updateTransaction();
233228
/* New, updated or removed address book entry */
234229
void updateAddressBook(const QString &address, const QString &label, bool isMine, wallet::AddressPurpose purpose, int status);
235-
/* Watch-only added */
236-
void updateWatchOnlyFlag(bool fHaveWatchonly);
237230
/* Current, immature or unconfirmed balance might have changed - emit 'balanceChanged' if so */
238231
void pollBalanceChanged();
239232
};

src/script/descriptor.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,6 @@ class AddressDescriptor final : public DescriptorImpl
799799
return OutputTypeFromDestination(m_destination);
800800
}
801801
bool IsSingleType() const final { return true; }
802-
bool IsSingleKey() const final { return false; }
803802
bool ToPrivateString(const SigningProvider& arg, std::string& out) const final { return false; }
804803

805804
std::optional<int64_t> ScriptSize() const override { return GetScriptForDestination(m_destination).size(); }
@@ -827,7 +826,6 @@ class RawDescriptor final : public DescriptorImpl
827826
return OutputTypeFromDestination(dest);
828827
}
829828
bool IsSingleType() const final { return true; }
830-
bool IsSingleKey() const final { return false; }
831829
bool ToPrivateString(const SigningProvider& arg, std::string& out) const final { return false; }
832830

833831
std::optional<int64_t> ScriptSize() const override { return m_script.size(); }
@@ -856,7 +854,6 @@ class PKDescriptor final : public DescriptorImpl
856854
public:
857855
PKDescriptor(std::unique_ptr<PubkeyProvider> prov, bool xonly = false) : DescriptorImpl(Vector(std::move(prov)), "pk"), m_xonly(xonly) {}
858856
bool IsSingleType() const final { return true; }
859-
bool IsSingleKey() const final { return true; }
860857

861858
std::optional<int64_t> ScriptSize() const override {
862859
return 1 + (m_xonly ? 32 : m_pubkey_args[0]->GetSize()) + 1;
@@ -892,7 +889,6 @@ class PKHDescriptor final : public DescriptorImpl
892889
PKHDescriptor(std::unique_ptr<PubkeyProvider> prov) : DescriptorImpl(Vector(std::move(prov)), "pkh") {}
893890
std::optional<OutputType> GetOutputType() const override { return OutputType::LEGACY; }
894891
bool IsSingleType() const final { return true; }
895-
bool IsSingleKey() const final { return true; }
896892

897893
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 1 + 20 + 1 + 1; }
898894

@@ -926,7 +922,6 @@ class WPKHDescriptor final : public DescriptorImpl
926922
WPKHDescriptor(std::unique_ptr<PubkeyProvider> prov) : DescriptorImpl(Vector(std::move(prov)), "wpkh") {}
927923
std::optional<OutputType> GetOutputType() const override { return OutputType::BECH32; }
928924
bool IsSingleType() const final { return true; }
929-
bool IsSingleKey() const final { return true; }
930925

931926
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 20; }
932927

@@ -968,7 +963,6 @@ class ComboDescriptor final : public DescriptorImpl
968963
public:
969964
ComboDescriptor(std::unique_ptr<PubkeyProvider> prov) : DescriptorImpl(Vector(std::move(prov)), "combo") {}
970965
bool IsSingleType() const final { return false; }
971-
bool IsSingleKey() const final { return true; }
972966
std::unique_ptr<DescriptorImpl> Clone() const override
973967
{
974968
return std::make_unique<ComboDescriptor>(m_pubkey_args.at(0)->Clone());
@@ -993,7 +987,6 @@ class MultisigDescriptor final : public DescriptorImpl
993987
public:
994988
MultisigDescriptor(int threshold, std::vector<std::unique_ptr<PubkeyProvider>> providers, bool sorted = false) : DescriptorImpl(std::move(providers), sorted ? "sortedmulti" : "multi"), m_threshold(threshold), m_sorted(sorted) {}
995989
bool IsSingleType() const final { return true; }
996-
bool IsSingleKey() const final { return false; }
997990

998991
std::optional<int64_t> ScriptSize() const override {
999992
const auto n_keys = m_pubkey_args.size();
@@ -1045,7 +1038,6 @@ class MultiADescriptor final : public DescriptorImpl
10451038
public:
10461039
MultiADescriptor(int threshold, std::vector<std::unique_ptr<PubkeyProvider>> providers, bool sorted = false) : DescriptorImpl(std::move(providers), sorted ? "sortedmulti_a" : "multi_a"), m_threshold(threshold), m_sorted(sorted) {}
10471040
bool IsSingleType() const final { return true; }
1048-
bool IsSingleKey() const final { return false; }
10491041

10501042
std::optional<int64_t> ScriptSize() const override {
10511043
const auto n_keys = m_pubkey_args.size();
@@ -1092,7 +1084,6 @@ class SHDescriptor final : public DescriptorImpl
10921084
return OutputType::LEGACY;
10931085
}
10941086
bool IsSingleType() const final { return true; }
1095-
bool IsSingleKey() const final { return m_subdescriptor_args[0]->IsSingleKey(); }
10961087

10971088
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 20 + 1; }
10981089

@@ -1134,7 +1125,6 @@ class WSHDescriptor final : public DescriptorImpl
11341125
WSHDescriptor(std::unique_ptr<DescriptorImpl> desc) : DescriptorImpl({}, std::move(desc), "wsh") {}
11351126
std::optional<OutputType> GetOutputType() const override { return OutputType::BECH32; }
11361127
bool IsSingleType() const final { return true; }
1137-
bool IsSingleKey() const final { return m_subdescriptor_args[0]->IsSingleKey(); }
11381128

11391129
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 32; }
11401130

@@ -1212,7 +1202,6 @@ class TRDescriptor final : public DescriptorImpl
12121202
}
12131203
std::optional<OutputType> GetOutputType() const override { return OutputType::BECH32M; }
12141204
bool IsSingleType() const final { return true; }
1215-
bool IsSingleKey() const final { return false; }
12161205

12171206
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 32; }
12181207

@@ -1340,7 +1329,6 @@ class MiniscriptDescriptor final : public DescriptorImpl
13401329

13411330
bool IsSolvable() const override { return true; }
13421331
bool IsSingleType() const final { return true; }
1343-
bool IsSingleKey() const final { return false; }
13441332

13451333
std::optional<int64_t> ScriptSize() const override { return m_node->ScriptSize(); }
13461334

@@ -1380,7 +1368,6 @@ class RawTRDescriptor final : public DescriptorImpl
13801368
RawTRDescriptor(std::unique_ptr<PubkeyProvider> output_key) : DescriptorImpl(Vector(std::move(output_key)), "rawtr") {}
13811369
std::optional<OutputType> GetOutputType() const override { return OutputType::BECH32M; }
13821370
bool IsSingleType() const final { return true; }
1383-
bool IsSingleKey() const final { return false; }
13841371

13851372
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 32; }
13861373

src/script/descriptor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ struct Descriptor {
111111
/** Whether this descriptor will return one scriptPubKey or multiple (aka is or is not combo) */
112112
virtual bool IsSingleType() const = 0;
113113

114-
/** Whether this descriptor only produces single key scripts (i.e. pk(), pkh(), wpkh(), sh() and wsh() nested of those, and combo())
115-
* TODO: Remove this method once legacy wallets are removed as it is only necessary for importmulti.
116-
*/
117-
virtual bool IsSingleKey() const = 0;
118-
119114
/** Convert the descriptor to a private string. This fails if the provided provider does not have the relevant private keys. */
120115
virtual bool ToPrivateString(const SigningProvider& provider, std::string& out) const = 0;
121116

0 commit comments

Comments
 (0)