Skip to content

Commit 5ce2199

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 c26bbec commit 5ce2199

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
@@ -3758,6 +3758,10 @@ util::Result<std::reference_wrapper<DescriptorScriptPubKeyMan>> CWallet::AddWall
37583758
// Save the descriptor to memory
37593759
uint256 id = new_spk_man->GetID();
37603760
AddScriptPubKeyMan(id, std::move(new_spk_man));
3761+
3762+
// Write the existing cache to disk
3763+
WalletBatch batch(GetDatabase());
3764+
batch.WriteDescriptorCacheItems(id, desc.cache);
37613765
}
37623766

37633767
// Add the private keys to the descriptor

0 commit comments

Comments
 (0)