Skip to content

Commit a399681

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 5e742d3 commit a399681

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
@@ -3748,6 +3748,10 @@ util::Result<std::reference_wrapper<DescriptorScriptPubKeyMan>> CWallet::AddWall
37483748
// Save the descriptor to memory
37493749
uint256 id = new_spk_man->GetID();
37503750
AddScriptPubKeyMan(id, std::move(new_spk_man));
3751+
3752+
// Write the existing cache to disk
3753+
WalletBatch batch(GetDatabase());
3754+
batch.WriteDescriptorCacheItems(id, desc.cache);
37513755
}
37523756

37533757
// Add the private keys to the descriptor

0 commit comments

Comments
 (0)