| 36 | } |
| 37 | |
| 38 | static void WalletLoadingDescriptors(benchmark::Bench& bench) |
| 39 | { |
| 40 | const auto test_setup = MakeNoLogFileContext<TestingSetup>(); |
| 41 | |
| 42 | WalletContext context; |
| 43 | context.args = &test_setup->m_args; |
| 44 | context.chain = test_setup->m_node.chain.get(); |
| 45 | |
| 46 | // Setup the wallet |
| 47 | // Loading the wallet will also create it |
| 48 | uint64_t create_flags = WALLET_FLAG_DESCRIPTORS; |
| 49 | DatabaseStatus status; |
| 50 | DatabaseOptions options; |
| 51 | options.require_format = DatabaseFormat::SQLITE; |
| 52 | options.require_create = true; |
| 53 | bilingual_str error; |
| 54 | auto database = MakeWalletDatabase("", options, status, error); |
| 55 | auto wallet = TestCreateWallet(std::move(database), context, create_flags); |
| 56 | |
| 57 | // Generate a bunch of transactions and addresses to put into the wallet |
| 58 | for (int i = 0; i < 1000; ++i) { |
| 59 | AddTx(*wallet); |
| 60 | } |
| 61 | |
| 62 | options.require_create = false; |
| 63 | options.require_existing = true; |
| 64 | |
| 65 | bench.epochs(5) |
| 66 | .setup([&] { |
| 67 | TestUnloadWallet(std::move(wallet)); |
| 68 | database = MakeWalletDatabase("", options, status, error); |
| 69 | }) |
| 70 | .run([&] { |
| 71 | wallet = TestLoadWallet(std::move(database), context); |
| 72 | }); |
| 73 | |
| 74 | // Cleanup |
| 75 | TestUnloadWallet(std::move(wallet)); |
| 76 | } |
| 77 | |
| 78 | BENCHMARK(WalletLoadingDescriptors); |
| 79 | } // namespace wallet |
nothing calls this directly
no test coverage detected