Skip to content

Commit bae12b3

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 0f9707f commit bae12b3

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

37503754
// Add the private keys to the descriptor

0 commit comments

Comments
 (0)