mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 06:49:38 -04: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
1 changed files with 1 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue