Skip to content

Commit a28bbb2

Browse files
committed
feat(chain): debug_assert non-wildcard desc. to only cache index 0
1 parent 132f91a commit a28bbb2

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
@@ -389,7 +389,11 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
389389
let _inserted = self
390390
.inner
391391
.insert_spk((keychain.clone(), new_index), new_spk);
392-
debug_assert!(_inserted, "must not have existing spk",);
392+
debug_assert!(_inserted, "must not have existing spk");
393+
debug_assert!(
394+
has_wildcard || new_index == 0,
395+
"non-wildcard descriptors must not iterate past index 0"
396+
);
393397
}
394398

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

0 commit comments

Comments
 (0)