@@ -32,6 +32,7 @@ static void WalletMigration(benchmark::Bench& bench)
32
32
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(test_setup->m_node .chain .get (), " " , CreateMockableWalletDatabase ());
33
33
wallet->chainStateFlushed (ChainstateRole::NORMAL, CBlockLocator{});
34
34
LegacyDataSPKM* legacy_spkm = wallet->GetOrCreateLegacyDataSPKM ();
35
+ WalletBatch batch{wallet->GetDatabase ()};
35
36
36
37
// Add watch-only addresses
37
38
std::vector<CScript> scripts_watch_only;
@@ -42,6 +43,7 @@ static void WalletMigration(benchmark::Bench& bench)
42
43
const CScript& script = scripts_watch_only.emplace_back (GetScriptForDestination (dest));
43
44
assert (legacy_spkm->LoadWatchOnly (script));
44
45
assert (wallet->SetAddressBook (dest, strprintf (" watch_%d" , w), /* purpose=*/ std::nullopt));
46
+ batch.WriteWatchOnly (script, CKeyMetadata ());
45
47
}
46
48
47
49
// Generate transactions and local addresses
@@ -58,6 +60,7 @@ static void WalletMigration(benchmark::Bench& bench)
58
60
mtx.vout .emplace_back (COIN, scripts_watch_only.at (j % NUM_WATCH_ONLY_ADDR));
59
61
mtx.vin .resize (2 );
60
62
wallet->AddToWallet (MakeTransactionRef (mtx), TxStateInactive{}, /* update_wtx=*/ nullptr , /* fFlushOnClose=*/ false , /* rescanning_old_block=*/ true );
63
+ batch.WriteKey (pubkey, key.GetPrivKey (), CKeyMetadata ());
61
64
}
62
65
63
66
bench.epochs (/* numEpochs=*/ 1 ).run ([&context, &wallet] {
0 commit comments