bench: ensure wallet migration benchmark runs exactly once

The migration benchmark crashes if run more than once, because of `std::move(wallet)` and leaves subsequent iterations in an undefined state - avoiding `UndefinedBehaviorSanitizer` null‑dereference error.
This commit is contained in:
Lőrinc 2025-04-19 20:09:11 +02:00
parent c1f458aaa0
commit cad39f86fb

View file

@ -61,7 +61,7 @@ static void WalletMigration(benchmark::Bench& bench)
batch.WriteKey(pubkey, key.GetPrivKey(), CKeyMetadata());
}
bench.epochs(/*numEpochs=*/1)
bench.epochs(/*numEpochs=*/1).epochIterations(/*numIters=*/1) // run the migration exactly once
.run([&] {
auto res{MigrateLegacyToDescriptor(std::move(wallet), /*passphrase=*/"", *loader->context(), /*was_loaded=*/false)};
assert(res);