mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 14:32:58 +02:00
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.
This commit is contained in:
@@ -32,6 +32,10 @@ static void WalletMigration(benchmark::Bench& bench)
|
||||
LegacyDataSPKM* legacy_spkm = wallet->GetOrCreateLegacyDataSPKM();
|
||||
WalletBatch batch{wallet->GetDatabase()};
|
||||
|
||||
// Write a best block record as migration expects one to exist
|
||||
CBlockLocator loc;
|
||||
batch.WriteBestBlock(loc);
|
||||
|
||||
// Add watch-only addresses
|
||||
std::vector<CScript> scripts_watch_only;
|
||||
for (int w = 0; w < NUM_WATCH_ONLY_ADDR; ++w) {
|
||||
|
Reference in New Issue
Block a user