Skip to content

Commit

Permalink
fix(chain): handle changeset where the index is greater that BIP32_MA…
Browse files Browse the repository at this point in the history
…X_INDEX
  • Loading branch information
f3r10 committed Jan 27, 2025
1 parent d270735 commit 6e3ddc8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/chain/src/indexer/keychain_txout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,12 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
pub fn apply_changeset(&mut self, changeset: ChangeSet) {
for (&desc_id, &index) in &changeset.last_revealed {
let v = self.last_revealed.entry(desc_id).or_default();
*v = index.max(*v);
let sanitized_index = if index > BIP32_MAX_INDEX {
BIP32_MAX_INDEX
} else {
index
};
*v = sanitized_index.max(*v);
self.replenish_inner_index_did(desc_id, self.lookahead);
}
}
Expand Down

0 comments on commit 6e3ddc8

Please sign in to comment.