diff --git a/doc/managing-wallets.md b/doc/managing-wallets.md index 1cfd2e5123..d24c413980 100644 --- a/doc/managing-wallets.md +++ b/doc/managing-wallets.md @@ -82,7 +82,7 @@ In the GUI, there is no specific menu item to unlock the wallet. When the user s 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. -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`. +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!". ``` $ bitcoin-cli -rpcwallet="wallet-01" backupwallet /home/node01/Backups/backup-01.dat diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index 51caae0a10..c8715231ea 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -38,12 +38,10 @@ static void SetupWalletToolArgs(ArgsManager& argsman) argsman.AddArg("-wallet=", "Specify wallet name", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::OPTIONS); argsman.AddArg("-dumpfile=", "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); argsman.AddArg("-debug=", "Output debugging information (default: 0).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); - argsman.AddArg("-descriptors", "Create descriptors wallet. Only for 'create'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); - argsman.AddArg("-legacy", "Create legacy wallet. Only for 'create'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -debug is true, 0 otherwise).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); argsman.AddCommand("info", "Get wallet info"); - argsman.AddCommand("create", "Create new wallet file"); + argsman.AddCommand("create", "Create a new descriptor wallet file"); argsman.AddCommand("dump", "Print out all of the wallet key-value records"); argsman.AddCommand("createfromdump", "Create new wallet file from dumped records"); } diff --git a/src/init.cpp b/src/init.cpp index a151c9d0a9..6a0f393faf 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -298,9 +298,6 @@ void Shutdown(NodeContext& node) StopREST(); StopRPC(); StopHTTPServer(); - for (const auto& client : node.chain_clients) { - client->flush(); - } StopMapPort(); // Because these depend on each-other, we make sure that neither can be diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index c9ef46243c..6945416cce 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -407,9 +407,6 @@ public: //! Start client execution and provide a scheduler. virtual void start(CScheduler& scheduler) = 0; - //! Save state to disk. - virtual void flush() = 0; - //! Shut down client. virtual void stop() = 0; diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 48d68c4e6b..9fc8ab0ef5 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -303,10 +303,6 @@ public: using TransactionChangedFn = std::function; virtual std::unique_ptr handleTransactionChanged(TransactionChangedFn fn) = 0; - //! Register handler for watchonly changed messages. - using WatchOnlyChangedFn = std::function; - virtual std::unique_ptr handleWatchOnlyChanged(WatchOnlyChangedFn fn) = 0; - //! Register handler for keypool changed messages. using CanGetAddressesChangedFn = std::function; virtual std::unique_ptr handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) = 0; diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index b4a60b427e..1870f65542 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -243,9 +243,6 @@ void TransactionView::setModel(WalletModel *_model) // hide column Watch-only updateWatchOnlyColumn(false); - - // Watch-only signal - connect(_model, &WalletModel::notifyWatchonlyChanged, this, &TransactionView::updateWatchOnlyColumn); } } diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 455f9f469e..07d5b9413c 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -45,7 +45,6 @@ WalletModel::WalletModel(std::unique_ptr wallet, ClientModel optionsModel(client_model.getOptionsModel()), timer(new QTimer(this)) { - fHaveWatchOnly = false; addressTableModel = new AddressTableModel(this); transactionTableModel = new TransactionTableModel(platformStyle, this); recentRequestsTableModel = new RecentRequestsTableModel(this); @@ -141,12 +140,6 @@ void WalletModel::updateAddressBook(const QString &address, const QString &label addressTableModel->updateEntry(address, label, isMine, purpose, status); } -void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly) -{ - fHaveWatchOnly = fHaveWatchonly; - Q_EMIT notifyWatchonlyChanged(fHaveWatchonly); -} - bool WalletModel::validateAddress(const QString& address) const { return IsValidDestinationString(address.toStdString()); @@ -405,13 +398,6 @@ static void ShowProgress(WalletModel *walletmodel, const std::string &title, int assert(invoked); } -static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly) -{ - bool invoked = QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag", Qt::QueuedConnection, - Q_ARG(bool, fHaveWatchonly)); - assert(invoked); -} - static void NotifyCanGetAddressesChanged(WalletModel* walletmodel) { bool invoked = QMetaObject::invokeMethod(walletmodel, "canGetAddressesChanged"); @@ -426,7 +412,6 @@ void WalletModel::subscribeToCoreSignals() 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)); m_handler_transaction_changed = m_wallet->handleTransactionChanged(std::bind(NotifyTransactionChanged, this, std::placeholders::_1, std::placeholders::_2)); m_handler_show_progress = m_wallet->handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2)); - m_handler_watch_only_changed = m_wallet->handleWatchOnlyChanged(std::bind(NotifyWatchonlyChanged, this, std::placeholders::_1)); m_handler_can_get_addrs_changed = m_wallet->handleCanGetAddressesChanged(std::bind(NotifyCanGetAddressesChanged, this)); } @@ -438,7 +423,6 @@ void WalletModel::unsubscribeFromCoreSignals() m_handler_address_book_changed->disconnect(); m_handler_transaction_changed->disconnect(); m_handler_show_progress->disconnect(); - m_handler_watch_only_changed->disconnect(); m_handler_can_get_addrs_changed->disconnect(); } diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index ab2096c1fe..8b849645f1 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -162,12 +162,10 @@ private: std::unique_ptr m_handler_address_book_changed; std::unique_ptr m_handler_transaction_changed; std::unique_ptr m_handler_show_progress; - std::unique_ptr m_handler_watch_only_changed; std::unique_ptr m_handler_can_get_addrs_changed; ClientModel* m_client_model; interfaces::Node& m_node; - bool fHaveWatchOnly; bool fForceCheckBalanceChanged{false}; // Wallet has an options model for wallet-specific options @@ -211,9 +209,6 @@ Q_SIGNALS: // Show progress dialog e.g. for rescan void showProgress(const QString &title, int nProgress); - // Watch-only address added - void notifyWatchonlyChanged(bool fHaveWatchonly); - // Signal that wallet is about to be removed void unload(); @@ -232,8 +227,6 @@ public Q_SLOTS: void updateTransaction(); /* New, updated or removed address book entry */ void updateAddressBook(const QString &address, const QString &label, bool isMine, wallet::AddressPurpose purpose, int status); - /* Watch-only added */ - void updateWatchOnlyFlag(bool fHaveWatchonly); /* Current, immature or unconfirmed balance might have changed - emit 'balanceChanged' if so */ void pollBalanceChanged(); }; diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index 0ba31829ea..71645c8746 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -799,7 +799,6 @@ public: return OutputTypeFromDestination(m_destination); } bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return false; } bool ToPrivateString(const SigningProvider& arg, std::string& out) const final { return false; } std::optional ScriptSize() const override { return GetScriptForDestination(m_destination).size(); } @@ -827,7 +826,6 @@ public: return OutputTypeFromDestination(dest); } bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return false; } bool ToPrivateString(const SigningProvider& arg, std::string& out) const final { return false; } std::optional ScriptSize() const override { return m_script.size(); } @@ -856,7 +854,6 @@ protected: public: PKDescriptor(std::unique_ptr prov, bool xonly = false) : DescriptorImpl(Vector(std::move(prov)), "pk"), m_xonly(xonly) {} bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return true; } std::optional ScriptSize() const override { return 1 + (m_xonly ? 32 : m_pubkey_args[0]->GetSize()) + 1; @@ -892,7 +889,6 @@ public: PKHDescriptor(std::unique_ptr prov) : DescriptorImpl(Vector(std::move(prov)), "pkh") {} std::optional GetOutputType() const override { return OutputType::LEGACY; } bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return true; } std::optional ScriptSize() const override { return 1 + 1 + 1 + 20 + 1 + 1; } @@ -926,7 +922,6 @@ public: WPKHDescriptor(std::unique_ptr prov) : DescriptorImpl(Vector(std::move(prov)), "wpkh") {} std::optional GetOutputType() const override { return OutputType::BECH32; } bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return true; } std::optional ScriptSize() const override { return 1 + 1 + 20; } @@ -968,7 +963,6 @@ protected: public: ComboDescriptor(std::unique_ptr prov) : DescriptorImpl(Vector(std::move(prov)), "combo") {} bool IsSingleType() const final { return false; } - bool IsSingleKey() const final { return true; } std::unique_ptr Clone() const override { return std::make_unique(m_pubkey_args.at(0)->Clone()); @@ -993,7 +987,6 @@ protected: public: MultisigDescriptor(int threshold, std::vector> providers, bool sorted = false) : DescriptorImpl(std::move(providers), sorted ? "sortedmulti" : "multi"), m_threshold(threshold), m_sorted(sorted) {} bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return false; } std::optional ScriptSize() const override { const auto n_keys = m_pubkey_args.size(); @@ -1045,7 +1038,6 @@ protected: public: MultiADescriptor(int threshold, std::vector> providers, bool sorted = false) : DescriptorImpl(std::move(providers), sorted ? "sortedmulti_a" : "multi_a"), m_threshold(threshold), m_sorted(sorted) {} bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return false; } std::optional ScriptSize() const override { const auto n_keys = m_pubkey_args.size(); @@ -1092,7 +1084,6 @@ public: return OutputType::LEGACY; } bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return m_subdescriptor_args[0]->IsSingleKey(); } std::optional ScriptSize() const override { return 1 + 1 + 20 + 1; } @@ -1134,7 +1125,6 @@ public: WSHDescriptor(std::unique_ptr desc) : DescriptorImpl({}, std::move(desc), "wsh") {} std::optional GetOutputType() const override { return OutputType::BECH32; } bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return m_subdescriptor_args[0]->IsSingleKey(); } std::optional ScriptSize() const override { return 1 + 1 + 32; } @@ -1212,7 +1202,6 @@ public: } std::optional GetOutputType() const override { return OutputType::BECH32M; } bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return false; } std::optional ScriptSize() const override { return 1 + 1 + 32; } @@ -1340,7 +1329,6 @@ public: bool IsSolvable() const override { return true; } bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return false; } std::optional ScriptSize() const override { return m_node->ScriptSize(); } @@ -1380,7 +1368,6 @@ public: RawTRDescriptor(std::unique_ptr output_key) : DescriptorImpl(Vector(std::move(output_key)), "rawtr") {} std::optional GetOutputType() const override { return OutputType::BECH32M; } bool IsSingleType() const final { return true; } - bool IsSingleKey() const final { return false; } std::optional ScriptSize() const override { return 1 + 1 + 32; } diff --git a/src/script/descriptor.h b/src/script/descriptor.h index 06e9f2679d..473649a314 100644 --- a/src/script/descriptor.h +++ b/src/script/descriptor.h @@ -111,11 +111,6 @@ struct Descriptor { /** Whether this descriptor will return one scriptPubKey or multiple (aka is or is not combo) */ virtual bool IsSingleType() const = 0; - /** Whether this descriptor only produces single key scripts (i.e. pk(), pkh(), wpkh(), sh() and wsh() nested of those, and combo()) - * TODO: Remove this method once legacy wallets are removed as it is only necessary for importmulti. - */ - virtual bool IsSingleKey() const = 0; - /** Convert the descriptor to a private string. This fails if the provided provider does not have the relevant private keys. */ virtual bool ToPrivateString(const SigningProvider& provider, std::string& out) const = 0; diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index 9ce7b5b24f..5308b4418d 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -535,10 +535,6 @@ public: return MakeSignalHandler(m_wallet->NotifyTransactionChanged.connect( [fn](const uint256& txid, ChangeType status) { fn(txid, status); })); } - std::unique_ptr handleWatchOnlyChanged(WatchOnlyChangedFn fn) override - { - return MakeSignalHandler(m_wallet->NotifyWatchonlyChanged.connect(fn)); - } std::unique_ptr handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) override { return MakeSignalHandler(m_wallet->NotifyCanGetAddressesChanged.connect(fn)); @@ -578,7 +574,6 @@ public: m_context.scheduler = &scheduler; return StartWallets(m_context); } - void flush() override {} void stop() override { return StopWallets(m_context); } void setMockTime(int64_t time) override { return SetMockTime(time); } void schedulerMockForward(std::chrono::seconds delta) override { Assert(m_context.scheduler)->MockForward(delta); } diff --git a/src/wallet/rpc/transactions.cpp b/src/wallet/rpc/transactions.cpp index 31e5813f41..f31596fce8 100644 --- a/src/wallet/rpc/transactions.cpp +++ b/src/wallet/rpc/transactions.cpp @@ -946,7 +946,7 @@ RPCHelpMan rescanblockchain() RPCHelpMan abortrescan() { return RPCHelpMan{"abortrescan", - "\nStops current wallet rescan triggered by an RPC call, e.g. by an rescanblockchain call.\n" + "Stops current wallet rescan triggered by an RPC call, e.g. by a rescanblockchain call.\n" "Note: Use \"getwalletinfo\" to query the scanning progress.\n", {}, RPCResult{RPCResult::Type::BOOL, "", "Whether the abort was successful"}, diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index eb445923a5..5422249ae1 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -820,13 +820,6 @@ std::optional LegacyDataSPKM::MigrateToDescriptor() return out; } -bool LegacyDataSPKM::DeleteRecords() -{ - return RunWithinTxn(m_storage.GetDatabase(), /*process_desc=*/"delete legacy records", [&](WalletBatch& batch){ - return DeleteRecordsWithDB(batch); - }); -} - bool LegacyDataSPKM::DeleteRecordsWithDB(WalletBatch& batch) { LOCK(cs_KeyStore); diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h index 777731d0d8..b52941227b 100644 --- a/src/wallet/scriptpubkeyman.h +++ b/src/wallet/scriptpubkeyman.h @@ -167,9 +167,6 @@ public: LogInfo("%s %s", m_storage.GetDisplayName(), tfm::format(wallet_fmt, params...)); }; - /** Watch-only address added */ - boost::signals2::signal NotifyWatchonlyChanged; - /** Keypool has new keys */ boost::signals2::signal NotifyCanGetAddressesChanged; @@ -270,7 +267,6 @@ public: * Does not modify this ScriptPubKeyMan. */ std::optional MigrateToDescriptor(); /** Delete all the records of this LegacyScriptPubKeyMan from disk*/ - bool DeleteRecords(); bool DeleteRecordsWithDB(WalletBatch& batch); }; diff --git a/src/wallet/test/walletload_tests.cpp b/src/wallet/test/walletload_tests.cpp index 43526fc88d..0c69849d0b 100644 --- a/src/wallet/test/walletload_tests.cpp +++ b/src/wallet/test/walletload_tests.cpp @@ -26,7 +26,6 @@ public: bool IsRange() const override { return false; } bool IsSolvable() const override { return false; } bool IsSingleType() const override { return true; } - bool IsSingleKey() const override { return true; } bool ToPrivateString(const SigningProvider& provider, std::string& out) const override { return false; } bool ToNormalizedString(const SigningProvider& provider, std::string& out, const DescriptorCache* cache = nullptr) const override { return false; } bool Expand(int pos, const SigningProvider& provider, std::vector& output_scripts, FlatSigningProvider& out, DescriptorCache* write_cache = nullptr) const override { return false; }; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 86d1cbdf30..3c5df17767 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3518,7 +3518,6 @@ bool CWallet::HaveCryptedKeys() const void CWallet::ConnectScriptPubKeyManNotifiers() { for (const auto& spk_man : GetActiveScriptPubKeyMans()) { - spk_man->NotifyWatchonlyChanged.connect(NotifyWatchonlyChanged); spk_man->NotifyCanGetAddressesChanged.connect(NotifyCanGetAddressesChanged); spk_man->NotifyFirstKeyTimeChanged.connect(std::bind(&CWallet::MaybeUpdateBirthTime, this, std::placeholders::_2)); } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index a3800e7290..e32b8c7272 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -842,9 +842,6 @@ public: /** Show progress e.g. for rescan */ boost::signals2::signal ShowProgress; - /** Watch-only address added */ - boost::signals2::signal NotifyWatchonlyChanged; - /** Keypool has new keys */ boost::signals2::signal NotifyCanGetAddressesChanged; diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp index 4ab1dd5e45..228f3efbfb 100644 --- a/src/wallet/wallettool.cpp +++ b/src/wallet/wallettool.cpp @@ -112,26 +112,6 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command) tfm::format(std::cerr, "The -dumpfile option can only be used with the \"dump\" and \"createfromdump\" commands.\n"); return false; } - if (args.IsArgSet("-descriptors")) { - if (command != "create") { - tfm::format(std::cerr, "The -descriptors option can only be used with the 'create' command.\n"); - return false; - } - if (!args.GetBoolArg("-descriptors", true)) { - tfm::format(std::cerr, "The -descriptors option must be set to \"true\"\n"); - return false; - } - } - if (args.IsArgSet("-legacy")) { - if (command != "create") { - tfm::format(std::cerr, "The -legacy option can only be used with the 'create' command.\n"); - return false; - } - if (args.GetBoolArg("-legacy", true)) { - tfm::format(std::cerr, "The -legacy option must be set to \"false\"\n"); - return false; - } - } if (command == "create" && !args.IsArgSet("-wallet")) { tfm::format(std::cerr, "Wallet name must be provided when creating a new wallet.\n"); return false; diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py index 2f8373ff36..bbf84d7a01 100755 --- a/test/functional/tool_wallet.py +++ b/test/functional/tool_wallet.py @@ -274,7 +274,7 @@ class ToolWalletTest(BitcoinTestFramework): self.assert_raises_tool_error('Dump file {} does not exist.'.format(non_exist_dump), '-wallet=todump', '-dumpfile={}'.format(non_exist_dump), 'createfromdump') wallet_path = self.nodes[0].wallets_path / "todump2" self.assert_raises_tool_error('Failed to create database path \'{}\'. Database already exists.'.format(wallet_path), '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump') - self.assert_raises_tool_error("The -descriptors option can only be used with the 'create' command.", '-descriptors', '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump') + self.assert_raises_tool_error("Invalid parameter -descriptors", '-descriptors', '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump') self.log.info('Checking createfromdump') self.do_tool_createfromdump("load", "wallet.dump") @@ -416,9 +416,9 @@ class ToolWalletTest(BitcoinTestFramework): def test_no_create_legacy(self): self.log.info("Test that legacy wallets cannot be created") - self.assert_raises_tool_error("The -legacy option must be set to \"false\"", "-wallet=legacy", "-legacy", "create") + self.assert_raises_tool_error("Invalid parameter -legacy", "-wallet=legacy", "-legacy", "create") assert not (self.nodes[0].wallets_path / "legacy").exists() - self.assert_raises_tool_error("The -descriptors option must be set to \"true\"", "-wallet=legacy", "-descriptors=false", "create") + self.assert_raises_tool_error("Invalid parameter -descriptors", "-wallet=legacy", "-descriptors=false", "create") assert not (self.nodes[0].wallets_path / "legacy").exists() def run_test(self): diff --git a/vcpkg.json b/vcpkg.json index 246d58d3b4..45a8a1a206 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -11,16 +11,9 @@ "qt", "tests", "wallet", - "berkeleydb", "zeromq" ], "features": { - "berkeleydb": { - "description": "Enable Berkeley DB wallet support", - "dependencies": [ - "berkeleydb" - ] - }, "qt": { "description": "Build GUI, Qt 6", "dependencies": [