Skip to content

Commit 7fd3e1c

Browse files
committed
wallet, bench: Write a bestblock record in WalletMigration
Migrating a wallet requires having a bestblock record. This is always the case in normal operation as such a record is always written on wallet loading if it didn't already exist. However, within the unit tests and benchmarks, this is not guaranteed. Since migration requires the record, WalletMigration needs to also add this record before the benchmark.
1 parent 6d3a8b1 commit 7fd3e1c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bench/wallet_migration.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ static void WalletMigration(benchmark::Bench& bench)
3232
LegacyDataSPKM* legacy_spkm = wallet->GetOrCreateLegacyDataSPKM();
3333
WalletBatch batch{wallet->GetDatabase()};
3434

35+
// Write a best block record as migration expects one to exist
36+
CBlockLocator loc;
37+
batch.WriteBestBlock(loc);
38+
3539
// Add watch-only addresses
3640
std::vector<CScript> scripts_watch_only;
3741
for (int w = 0; w < NUM_WATCH_ONLY_ADDR; ++w) {

0 commit comments

Comments
 (0)