diff --git a/src/bench/wallet_migration.cpp b/src/bench/wallet_migration.cpp index ca28ab04487..87710d41d80 100644 --- a/src/bench/wallet_migration.cpp +++ b/src/bench/wallet_migration.cpp @@ -3,14 +3,15 @@ // file COPYING or https://www.opensource.org/licenses/mit-license.php. #include -#include #include +#include +#include #include #include #include -#include #include #include +#include #include #include @@ -19,11 +20,8 @@ namespace wallet{ static void WalletMigration(benchmark::Bench& bench) { - const auto test_setup = MakeNoLogFileContext(); - - WalletContext context; - context.args = &test_setup->m_args; - context.chain = test_setup->m_node.chain.get(); + const auto test_setup{MakeNoLogFileContext()}; + const auto loader{MakeWalletLoader(*test_setup->m_node.chain, test_setup->m_args)}; // Number of imported watch only addresses int NUM_WATCH_ONLY_ADDR = 20; @@ -63,12 +61,13 @@ static void WalletMigration(benchmark::Bench& bench) batch.WriteKey(pubkey, key.GetPrivKey(), CKeyMetadata()); } - bench.epochs(/*numEpochs=*/1).run([&context, &wallet] { - util::Result res = MigrateLegacyToDescriptor(std::move(wallet), /*passphrase=*/"", context, /*was_loaded=*/false); - assert(res); - assert(res->wallet); - assert(res->watchonly_wallet); - }); + bench.epochs(/*numEpochs=*/1) + .run([&] { + auto res{MigrateLegacyToDescriptor(std::move(wallet), /*passphrase=*/"", *loader->context(), /*was_loaded=*/false)}; + assert(res); + assert(res->wallet); + assert(res->watchonly_wallet); + }); } BENCHMARK(WalletMigration, benchmark::PriorityLevel::LOW);