Skip to content

Commit 1772517

Browse files
committed
wallet: Write new descriptor's cache in AddWalletDescriptor
If a new WalletDescriptor is provided to us with a cache, write the cache to disk as well.
1 parent b7b6f21 commit 1772517

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/wallet/wallet.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3757,6 +3757,10 @@ util::Result<std::reference_wrapper<DescriptorScriptPubKeyMan>> CWallet::AddWall
37573757
// Save the descriptor to memory
37583758
uint256 id = new_spk_man->GetID();
37593759
AddScriptPubKeyMan(id, std::move(new_spk_man));
3760+
3761+
// Write the existing cache to disk
3762+
WalletBatch batch(GetDatabase());
3763+
batch.WriteDescriptorCacheItems(id, desc.cache);
37603764
}
37613765

37623766
// Add the private keys to the descriptor

0 commit comments

Comments
 (0)