Skip to content

Commit 6ddecc9

Browse files
committed
refactor(keychain_txout): apply_changeset restores spk cache before last revealed
This change improves readability and maintains logical consistency with the use of `spk_cache` throughout the `keychain_txout` module.
1 parent d9c2b95 commit 6ddecc9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/chain/src/indexer/keychain_txout.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -938,16 +938,16 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
938938

939939
/// Applies the `ChangeSet<K>` to the [`KeychainTxOutIndex<K>`]
940940
pub fn apply_changeset(&mut self, changeset: ChangeSet) {
941-
for (did, index) in changeset.last_revealed {
942-
let v = self.last_revealed.entry(did).or_default();
943-
*v = index.max(*v);
944-
self.replenish_inner_index_did(did, self.lookahead);
945-
}
946941
if self.persist_spks {
947942
for (did, spks) in changeset.spk_cache {
948943
self.spk_cache.entry(did).or_default().extend(spks);
949944
}
950945
}
946+
for (did, index) in changeset.last_revealed {
947+
let v = self.last_revealed.entry(did).or_default();
948+
*v = index.max(*v);
949+
self.replenish_inner_index_did(did, self.lookahead);
950+
}
951951
}
952952
}
953953

0 commit comments

Comments
 (0)