mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 06:49:38 -04:00
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Windows native, VS 2022 (push) Waiting to run
CI / Windows native, fuzz, VS 2022 (push) Waiting to run
CI / Linux->Windows cross, no tests (push) Waiting to run
CI / Windows, test cross-built (push) Blocked by required conditions
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
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-ACK17bb63f9f9
pablomartin4btc: re-ACK17bb63f9f9
laanwj: re-ACK17bb63f9f9
Tree-SHA512: d7a86df1f71f12451b335f22f7c3f0394166ac3f8f5b81f6bbf0321026e2e8ed621576656c371d70e202df1be4410b2b1c1acb5d5f0c341e7b67aaa0ac792e7c
73 lines
2.6 KiB
C++
73 lines
2.6 KiB
C++
// Copyright (c) 2022 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <addresstype.h>
|
|
#include <bench/bench.h>
|
|
#include <key.h>
|
|
#include <key_io.h>
|
|
#include <script/descriptor.h>
|
|
#include <script/script.h>
|
|
#include <script/signingprovider.h>
|
|
#include <sync.h>
|
|
#include <test/util/setup_common.h>
|
|
#include <wallet/context.h>
|
|
#include <wallet/db.h>
|
|
#include <wallet/test/util.h>
|
|
#include <wallet/types.h>
|
|
#include <wallet/wallet.h>
|
|
#include <wallet/walletutil.h>
|
|
|
|
#include <cassert>
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <utility>
|
|
|
|
namespace wallet {
|
|
static void WalletIsMine(benchmark::Bench& bench, int num_combo = 0)
|
|
{
|
|
const auto test_setup = MakeNoLogFileContext<TestingSetup>();
|
|
|
|
WalletContext context;
|
|
context.args = &test_setup->m_args;
|
|
context.chain = test_setup->m_node.chain.get();
|
|
|
|
// Setup the wallet
|
|
// Loading the wallet will also create it
|
|
uint64_t create_flags = WALLET_FLAG_DESCRIPTORS;
|
|
auto database = CreateMockableWalletDatabase();
|
|
auto wallet = TestLoadWallet(std::move(database), context, create_flags);
|
|
|
|
// For a descriptor wallet, fill with num_combo combo descriptors with random keys
|
|
// This benchmarks a non-HD wallet migrated to descriptors
|
|
if (num_combo > 0) {
|
|
LOCK(wallet->cs_wallet);
|
|
for (int i = 0; i < num_combo; ++i) {
|
|
CKey key;
|
|
key.MakeNewKey(/*fCompressed=*/true);
|
|
FlatSigningProvider keys;
|
|
std::string error;
|
|
std::vector<std::unique_ptr<Descriptor>> desc = Parse("combo(" + EncodeSecret(key) + ")", keys, error, /*require_checksum=*/false);
|
|
WalletDescriptor w_desc(std::move(desc.at(0)), /*creation_time=*/0, /*range_start=*/0, /*range_end=*/0, /*next_index=*/0);
|
|
auto spk_manager = *Assert(wallet->AddWalletDescriptor(w_desc, keys, /*label=*/"", /*internal=*/false));
|
|
assert(spk_manager);
|
|
}
|
|
}
|
|
|
|
const CScript script = GetScriptForDestination(DecodeDestination(ADDRESS_BCRT1_UNSPENDABLE));
|
|
|
|
bench.run([&] {
|
|
LOCK(wallet->cs_wallet);
|
|
isminetype mine = wallet->IsMine(script);
|
|
assert(mine == ISMINE_NO);
|
|
});
|
|
|
|
TestUnloadWallet(std::move(wallet));
|
|
}
|
|
|
|
static void WalletIsMineDescriptors(benchmark::Bench& bench) { WalletIsMine(bench); }
|
|
static void WalletIsMineMigratedDescriptors(benchmark::Bench& bench) { WalletIsMine(bench, /*num_combo=*/2000); }
|
|
BENCHMARK(WalletIsMineDescriptors, benchmark::PriorityLevel::LOW);
|
|
BENCHMARK(WalletIsMineMigratedDescriptors, benchmark::PriorityLevel::LOW);
|
|
} // namespace wallet
|