Skip to content

Commit 5f1ee2c

Browse files
evanlinjindanielabrozzoni
authored andcommitted
feat(chain): debug_assert non-wildcard desc. to only cache index 0
1 parent 887e112 commit 5f1ee2c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/chain/src/keychain/txout_index.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,11 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
390390
let _inserted = self
391391
.inner
392392
.insert_spk((keychain.clone(), new_index), new_spk);
393-
debug_assert!(_inserted, "must not have existing spk",);
393+
debug_assert!(_inserted, "must not have existing spk");
394+
debug_assert!(
395+
has_wildcard || new_index == 0,
396+
"non-wildcard descriptors must not iterate past index 0"
397+
);
394398
}
395399

396400
let _old_index = self.last_revealed.insert(keychain.clone(), target_index);

0 commit comments

Comments
 (0)