|
|
|
@ -1807,17 +1807,8 @@ bool DescriptorScriptPubKeyMan::TopUp(unsigned int size)
|
|
|
|
|
}
|
|
|
|
|
// Merge and write the cache
|
|
|
|
|
DescriptorCache new_items = m_wallet_descriptor.cache.MergeAndDiff(temp_cache);
|
|
|
|
|
for (const auto& parent_xpub_pair : new_items.GetCachedParentExtPubKeys()) {
|
|
|
|
|
if (!batch.WriteDescriptorParentCache(parent_xpub_pair.second, id, parent_xpub_pair.first)) {
|
|
|
|
|
throw std::runtime_error(std::string(__func__) + ": writing cache item failed");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (const auto& derived_xpub_map_pair : new_items.GetCachedDerivedExtPubKeys()) {
|
|
|
|
|
for (const auto& derived_xpub_pair : derived_xpub_map_pair.second) {
|
|
|
|
|
if (!batch.WriteDescriptorDerivedCache(derived_xpub_pair.second, id, derived_xpub_map_pair.first, derived_xpub_pair.first)) {
|
|
|
|
|
throw std::runtime_error(std::string(__func__) + ": writing cache item failed");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!batch.WriteDescriptorCacheItems(id, new_items)) {
|
|
|
|
|
throw std::runtime_error(std::string(__func__) + ": writing cache items failed");
|
|
|
|
|
}
|
|
|
|
|
m_max_cached_index++;
|
|
|
|
|
}
|
|
|
|
|