To prepare for the deletion of legacy wallet code, disable creating or loading new legacy wallets.
Tests for the legacy wallet specifically are deleted.
To prepare for the deletion of legacy wallet code, disable creating or loading new legacy wallets.
Tests for the legacy wallet specifically are deleted.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31250.
See the guideline for information on the review process.
Type | Reviewers |
---|---|
ACK | Sjors, brunoerg |
Concept ACK | pablomartin4btc |
Stale ACK | maflcko |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Reviewers, this pull request conflicts with the following ones:
send
and sendall
by ishaanam)If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/36510219942
Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
74-static void WalletIsMineLegacy(benchmark::Bench& bench) { WalletIsMine(bench, /*legacy_wallet=*/true); }
75-BENCHMARK(WalletIsMineLegacy, benchmark::PriorityLevel::LOW);
76-#endif
77-
78 #ifdef USE_SQLITE
79 static void WalletIsMineDescriptors(benchmark::Bench& bench) { WalletIsMine(bench, /*legacy_wallet=*/false); }
375@@ -395,56 +376,6 @@ void TestGUI(interfaces::Node& node, const std::shared_ptr<CWallet>& wallet)
376 QCOMPARE(walletModel.wallet().getAddressReceiveRequests().size(), size_t{0});
377 }
378
379-void TestGUIWatchOnly(interfaces::Node& node, TestChain100Setup& test)
380-{
381- const std::shared_ptr<CWallet>& wallet = SetupLegacyWatchOnlyWallet(node, test);
Testing the PSBT workflow would be still be useful though.
In 801d2b1c3f25c6922df04cce4b2baa2047173eab “test: Remove legacy wallet unit tests”
143@@ -144,20 +144,6 @@ def run_test(self):
144 restorewo_wallet.importaddress(wo2, rescan=False)
145 restorewo_wallet.importaddress(wo3, rescan=False)
146
147- # check user has 0 balance and no transactions
importaddress
calls importdescriptors
in the test framework. These checks are that importaddress
(the legacy wallet RPC) doesn’t rescan and will require a separate rescan. But that will not work once the tests is descriptor wallets only.
Will expand the commit message.
Will expand the commit message.
Thanks for explaining. I understand that the test framework calls importdescriptors
on importaddress
internally. However, if the checks are wrong, why does the test not fail on current master?
In fact there is a comment and workaround to address this specifically in this test:
0 # for descriptor wallets, the test framework maps the importaddress RPC to the
1 # importdescriptors RPC (with argument 'timestamp'='now'), which always rescans
2 # blocks of the past 2 hours, based on the current MTP timestamp; in order to avoid
3 # importing the last address (wo3), we advance the time further and generate 10 blocks
So it seems the workaround is not working?
legacy_nodes
?
Done
Edit: It’s not unused.
19- self.add_wallet_options(parser)
20-
21 def set_test_params(self):
22 self.num_nodes = 1
23 self.setup_clean_chain = True
24+ self.uses_wallet = True
skip_if_no_wallet
already does it?
197+ // Make sure that the dump was created from a sqlite database only as that is the only
198+ // type of database that we still support.
199+ // Other formats such as BDB should not be loaded into a sqlite database since they also
200+ // use a different type of wallet entirely which is no longer compatible with this software.
201+ if (format_value != "sqlite") {
202+ error = _("Error: Dumpfile specifies an unsupported database format");
nit in f19592a06059b44d55838bf2f8c63fde2917ee83: Could extend the error msg? Something like:
"Error: Dumpfile specifies an unsupported database format (%s). Only sqlite database dumps are supported."
?
623@@ -626,7 +624,6 @@ message(" libbitcoinkernel (experimental) ..... ${BUILD_KERNEL_LIB}")
624 message("Optional features:")
625 message(" wallet support ...................... ${ENABLE_WALLET}")
626 if(ENABLE_WALLET)
627- message(" - descriptor wallets (SQLite) ...... ${WITH_SQLITE}")
628 message(" - legacy wallets (Berkeley DB) ..... ${WITH_BDB}")
It only removes sqlite as an optional dependency when the wallet is enabled, so I think having this log line is redundant. Removing the BDB line is still incorrect at this time as it can be built with and used (in this commit).
I’m not sure what in the commit message needs fixing.
I’m not sure what in the commit message needs fixing.
The commit message refers to the configure option, but the project is using cmake, but this is just a nit.
Also, this is the only build-system commit in this pull request. I’d say it could make sense to split it up into it’s own pull request, because:
Needs rebase.
I left some nits, feel free to ignore.
I skipped over the large commit and the last two.
Otherwise:
review ACK 82fc65c9ab53c416935b5eb20be10fe69ded8b88 👨
Signature:
0untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
2trusted comment: review ACK 82fc65c9ab53c416935b5eb20be10fe69ded8b88 👨
31738Jue8VRvURHJG6ZrNb0UzewDcwNZT7SO5vi0tlLfJlYOf/7IVJSk5W9mompg0cCbyr9xc3mF6TE876MUeBg==
🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/37419946977
Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
Clarified my nits a bit, nothing blocking.
I still haven’t reviewed the last commit and the large commit. I wonder if it is possible to split the large commit into one that removes test files (or test cases) and one that does the test framework change, possibly making review easier.
re-ACK b8494154e174481bbc0350013f1960973f35f3fc 🔑
Signature:
0untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
2trusted comment: re-ACK b8494154e174481bbc0350013f1960973f35f3fc 🔑
3FHB3gaGmlXUnVYceoczXV52txwmCFbqMqxMuJLOB1MC2BCTd8xLZoCVRxUH3Kz+37u17PYG18Jd3OynL2tgbDg==
🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/38265204038
Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
85@@ -86,7 +86,6 @@
86 'feature_pruning.py',
87 'feature_dbcrash.py',
88 'feature_index_prune.py',
89- 'wallet_pruning.py --legacy-wallet',
56e9bef655673becb3e265948143a9e860a5c68b: nit: could also update the example in test_runner.py
:
0for exclude_test in exclude_tests:
1 # A space in the name indicates it has arguments such as "wallet_basic.py --descriptors"
2 if ' ' in exclude_test:
3048@@ -3049,7 +3049,11 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
3049 error = strprintf(_("Unexpected legacy entry in descriptor wallet found. Loading wallet %s\n\n"
3050 "The wallet might have been tampered with or created with malicious intent.\n"), walletFile);
3051 return nullptr;
3052- } else {
3053+ } else if (nLoadWalletRet == DBErrors::LEGACY_WALLET) {
3054+ error = strprintf(_("Error loading %s: Wallet is a legacy wallet. Please migrate to a descriptor wallet using the migration tool (migratewallet RPC)."), walletFile);
MakeDatabase
).
147@@ -148,18 +148,6 @@ def run_test(self):
148 addr = recv_wrpc.getnewaddress()
149 send_wrpc.sendtoaddress(addr, 10)
150
151- # Make sure things are disabled
152- self.log.info("Test disabled RPCs")
In 8afd005cbf9209e90a5cc1bcdb2c0ff400c2de33 “test: rpcs disabled for descriptor wallets were removed”: I’m confused by the commit message. Should this commit go later? Or maybe reword it as “will go away in the next commits”.
At this commit they still exist and there’s other tests that refer to them, e.g. rpcnestedtests.cpp
129-#ifdef USE_BDB
130- dbs.emplace_back(MakeBerkeleyDatabase(path_root / "bdb", options, status, error));
131- // Needs BDB to make the DB to read
132- dbs.emplace_back(std::make_unique<BerkeleyRODatabase>(BDBDataFile(path_root / "bdb"), /*open=*/false));
133-#endif
134+ // Unable to test BerkeleyRO since we cannot create a new BDB database to open
BerkeleyRO
through the migration tests - which use previous releases to generate them on the fly.
194@@ -195,141 +195,6 @@ BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup)
195 }
196 }
197
198-BOOST_FIXTURE_TEST_CASE(importmulti_rescan, TestChain100Setup)
109- SerializeMany(s, args...);
110- return {s.begin(), s.end()};
111-}
112-
113-
114-BOOST_FIXTURE_TEST_CASE(wallet_load_ckey, TestingSetup)
ACK ba2042c31f1630678a1f08bb68e01c1d98cc9abc
Though there’s a few places where we could salvage test coverage (in a followup).
I ran the test suite on all commits.
wallet_upgradewallet.py
is dropped. The test itself was only run for legacy wallets. However the upgradewallet
RPC isn’t legacy-only, even though it doesn’t (currently) do anything useful for descriptor wallets. Maybe we should drop it here or in #28710? Or otherwise at least have some trivial coverage.
Should test/functional/wallet_pruning.py
be retrofitted for descriptor wallets instead of deleting it?
First commit now matches ac6cde731314d981391bc313c98d671c68211d33 from #31961.
Note that 928760e6dd8383db2dbe87f99185b07cf13bcab3 drops backward compatibility tests for the legacy wallet, but ba2042c31f1630678a1f08bb68e01c1d98cc9abc brings new coverage (and we also have dedicated migration coverage).
345+
346+ hdkeypath = addr_info["hdkeypath"].replace("'", "h")
347+ pubkey = addr_info["pubkey"]
348+
349+ # Make a backup of the wallet file
350+ backup_path = os.path.join(self.options.tmpdir, f"{wallet_name}.dat")
backup_path
and pubkey
are unused.
code review ACK ba2042c31f1630678a1f08bb68e01c1d98cc9abc no blockers!
restorewo_wallet
is a descriptor wallet (can be confirmed with getwalletinfo
- {'walletname': 'wo', 'walletversion': 169900, 'format': 'sqlite', 'balance': Decimal('0E-8'), 'unconfirmed_balance': Decimal('0E-8'), 'immature_balance': Decimal('0E-8'), 'txcount': 0, 'keypoolsize': 0, 'keypoolsize_hd_internal': 0, 'paytxfee': Decimal('0E-8'), 'private_keys_enabled': False, 'avoid_reuse': False, 'scanning': False, 'descriptors': True, 'external_signer': False, 'blank': False, 'lastprocessedblock': {'hash': '77a656f562fcce93cb25747e1d3ef773b0803feca410587bd3e6cff9975dd5fc', 'height': 611}}
), so there is no need to rescan since importaddress
will call importdescriptors
and therefore do it.Successfully ran bench, unit and functional tests on MacOS 14.3.
Since importdescriptors (which the legacy wallet import* RPCs use for
descriptor wallets in the test framework) always rescans, the checks
in wallet_transactiontime_rescan for import* RPCs not rescanning, and
subsequently requring a rescan, are incorrect.
Removes all legacy wallet specific functional tests.
Also removes the --descriptor and --legacy-wallet options as these are
no longer necessary with the legacy wallet removed.
Salvage is bdb only which is about to be removed.
Legacy wallets do not have the descriptors flag set. Don't load wallets
without the descriptors flag.
At the same time, we will no longer load BDB databases since they are
only used for legacy wallets.
44 argsman.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -debug is true, 0 otherwise).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
45 argsman.AddArg("-withinternalbdb", "Use the internal Berkeley DB parser when dumping a Berkeley DB wallet file (default: false)", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
46
47 argsman.AddCommand("info", "Get wallet info");
48 argsman.AddCommand("create", "Create new wallet file");
49- argsman.AddCommand("salvage", "Attempt to recover private keys from a corrupt wallet. Warning: 'salvage' is experimental.");
-salvage
for corrupted sqlite wallets, but makes sense to remove it for now.
197+ // Make sure that the dump was created from a sqlite database only as that is the only
198+ // type of database that we still support.
199+ // Other formats such as BDB should not be loaded into a sqlite database since they also
200+ // use a different type of wallet entirely which is no longer compatible with this software.
201+ if (format_value != "sqlite") {
202+ error = strprintf(_("Error: Dumpfile specifies an unsupported database format (%s). Only sqlite database dumps are supported"), format_value);
return false;
?
3051@@ -3052,7 +3052,11 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
3052 error = strprintf(_("Unexpected legacy entry in descriptor wallet found. Loading wallet %s\n\n"
3053 "The wallet might have been tampered with or created with malicious intent.\n"), walletFile);
3054 return nullptr;
3055- } else {
3056+ } else if (nLoadWalletRet == DBErrors::LEGACY_WALLET) {
3057+ error = strprintf(_("Error loading %s: Wallet is a legacy wallet. Please migrate to a descriptor wallet using the migration tool (migratewallet RPC)."), walletFile);
3058+ return nullptr;
3059+ }
} else {
?
484@@ -485,6 +485,11 @@ static DBErrors LoadWalletFlags(CWallet* pwallet, DatabaseBatch& batch) EXCLUSIV
485 pwallet->WalletLogPrintf("Error reading wallet database: Unknown non-tolerable wallet flags found\n");
486 return DBErrors::TOO_NEW;
487 }
488+ // All wallets must be descriptor wallets unless opened with a bdb_ro db
489+ // bdb_ro is only used for legacy to descriptor migration.
490+ if (pwallet->GetDatabase().Format() != "bdb_ro" && !pwallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
Why do we compare strings here instead of use the enum DatabaseFormat
?
Edit: Okay, looks like WalletDatabase
doesn’t have such a field, there’s only the string, no need to change that here.
🐙 This pull request conflicts with the target branch and needs rebase.
Concept ACK
Light cr (by commit - will do another round next week) & tACK 32a522f2d825957f0c85d7b4ea9185a053b018e3
Verified when I try to load a legacy wallet (via RPC or from QT
menu) I get:
“... The wallet appears to be a Legacy wallet, please use the wallet migration tool (migratewallet RPC).
”
Also, running QT
with legacy wallets in the settings.json
will produce same output above closing the app with that error description ("Error: Failed to open database path...
").
I can see we are still able to create legacy via RPC (n longer the case in final #28710 - with -deprecatedrpc=create_bdb
), and if I run te command in the QT console I get the wallet loaded:
Is this correct or needs to be fixed in this PR?
Adding more details from my previous comment:
sqlite
DB (the unsupported legacy-sqlite mentioned above):
https://github.com/bitcoin/bitcoin/blob/32a522f2d825957f0c85d7b4ea9185a053b018e3/src/wallet/walletdb.cpp#L1471-L1477getwalletinfo
we could see "format": "sqlite",
;