Skip to content

Commit 76dd4ed

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 32e2725 commit 76dd4ed

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
@@ -3744,6 +3744,10 @@ util::Result<std::reference_wrapper<DescriptorScriptPubKeyMan>> CWallet::AddWall
37443744
// Save the descriptor to memory
37453745
uint256 id = new_spk_man->GetID();
37463746
AddScriptPubKeyMan(id, std::move(new_spk_man));
3747+
3748+
// Write the existing cache to disk
3749+
WalletBatch batch(GetDatabase());
3750+
batch.WriteDescriptorCacheItems(id, desc.cache);
37473751
}
37483752

37493753
// Add the private keys to the descriptor

0 commit comments

Comments
 (0)