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:
1 parent
c1f458aaa0
commit
cad39f86fb
1 file changed
+1
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user