Merge bitcoin/bitcoin#31250: wallet: Disable creating and loading legacy wallets

17bb63f9f9 wallet: Disallow loading legacy wallets (Ava Chow)
9f04e02ffa wallet: Disallow creating legacy wallets (Ava Chow)
6b247279b7 wallet: Disallow legacy wallet creation from the wallet tool (Ava Chow)
5e93b1fd6c bench: Remove WalletLoadingLegacy benchmark (Ava Chow)
56f959d829 wallet: Remove wallettool salvage (Ava Chow)
7a41c939f0 wallet: Remove -format and bdb from wallet tool's createfromdump (Ava Chow)
c847dee148 test: remove legacy wallet functional tests (Ava Chow)
20a9173717 test: Remove legacy wallet tests from wallet_reindex.py (Ava Chow)
446d480cb2 test: Remove legacy wallet tests from wallet_backwards_compatibility.py (Ava Chow)
aff80298d0 test: wallet_signer.py bdb will be removed (Ava Chow)
f94f9399ac test: Remove legacy wallet unit tests (Ava Chow)
d9ac9dbd8e tests, gui: Use descriptors watchonly wallet for watchonly test (Ava Chow)

Pull request description:

  To prepare for the deletion of legacy wallet code, disable creating or loading new legacy wallets.

  Tests for the legacy wallet specifically are deleted.

  Split from https://github.com/bitcoin/bitcoin/pull/28710

ACKs for top commit:
  Sjors:
    re-ACK 17bb63f9f9
  pablomartin4btc:
    re-ACK 17bb63f9f9
  laanwj:
    re-ACK 17bb63f9f9

Tree-SHA512: d7a86df1f71f12451b335f22f7c3f0394166ac3f8f5b81f6bbf0321026e2e8ed621576656c371d70e202df1be4410b2b1c1acb5d5f0c341e7b67aaa0ac792e7c
This commit is contained in:
merge-script committed 2025-04-25 13:11:24 +01:00
commit 80e6ad9e30
115 files changed
+540 -5610

No files matched your search

+15 -23
View File
@@ -189,36 +189,28 @@ void SyncUpWallet(const std::shared_ptr<CWallet>& wallet, interfaces::Node& node
QVERIFY(result.last_failed_block.IsNull());
}
std::shared_ptr<CWallet> SetupLegacyWatchOnlyWallet(interfaces::Node& node, TestChain100Setup& test)
{
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", CreateMockableWalletDatabase());
wallet->LoadWallet();
{
LOCK(wallet->cs_wallet);
wallet->SetWalletFlag(WALLET_FLAG_DISABLE_PRIVATE_KEYS);
wallet->SetupLegacyScriptPubKeyMan();
// Add watched key
CPubKey pubKey = test.coinbaseKey.GetPubKey();
bool import_keys = wallet->ImportPubKeys({{pubKey.GetID(), false}}, {{pubKey.GetID(), pubKey}} , /*key_origins=*/{}, /*add_keypool=*/false, /*timestamp=*/1);
assert(import_keys);
wallet->SetLastBlockProcessed(105, WITH_LOCK(node.context()->chainman->GetMutex(), return node.context()->chainman->ActiveChain().Tip()->GetBlockHash()));
}
SyncUpWallet(wallet, node);
return wallet;
}
std::shared_ptr<CWallet> SetupDescriptorsWallet(interfaces::Node& node, TestChain100Setup& test)
std::shared_ptr<CWallet> SetupDescriptorsWallet(interfaces::Node& node, TestChain100Setup& test, bool watch_only = false)
{
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", CreateMockableWalletDatabase());
wallet->LoadWallet();
LOCK(wallet->cs_wallet);
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
wallet->SetupDescriptorScriptPubKeyMans();
if (watch_only) {
wallet->SetWalletFlag(WALLET_FLAG_DISABLE_PRIVATE_KEYS);
} else {
wallet->SetupDescriptorScriptPubKeyMans();
}
// Add the coinbase key
FlatSigningProvider provider;
std::string error;
auto descs = Parse("combo(" + EncodeSecret(test.coinbaseKey) + ")", provider, error, /* require_checksum=*/ false);
std::string key_str;
if (watch_only) {
key_str = HexStr(test.coinbaseKey.GetPubKey());
} else {
key_str = EncodeSecret(test.coinbaseKey);
}
auto descs = Parse("combo(" + key_str + ")", provider, error, /* require_checksum=*/ false);
assert(!descs.empty());
assert(descs.size() == 1);
auto& desc = descs.at(0);
@@ -398,7 +390,7 @@ void TestGUI(interfaces::Node& node, const std::shared_ptr<CWallet>& wallet)
void TestGUIWatchOnly(interfaces::Node& node, TestChain100Setup& test)
{
const std::shared_ptr<CWallet>& wallet = SetupLegacyWatchOnlyWallet(node, test);
const std::shared_ptr<CWallet>& wallet = SetupDescriptorsWallet(node, test, /*watch_only=*/true);
// Create widgets and init models
std::unique_ptr<const PlatformStyle> platformStyle(PlatformStyle::instantiate("other"));
@@ -410,7 +402,7 @@ void TestGUIWatchOnly(interfaces::Node& node, TestChain100Setup& test)
// Update walletModel cached balance which will trigger an update for the 'labelBalance' QLabel.
walletModel.pollBalanceChanged();
// Check balance in send dialog
CompareBalance(walletModel, walletModel.wallet().getBalances().watch_only_balance,
CompareBalance(walletModel, walletModel.wallet().getBalances().balance,
sendCoinsDialog.findChild<QLabel*>("labelBalance"));
// Set change address