mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-03 08:21:29 +02:00
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:
parent
c1f458aaa0
commit
cad39f86fb
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user