feat(chain): debug_assert non-wildcard desc. to only cache index 0

This commit is contained in:
志宇 2024-01-09 09:44:06 +08:00 committed by Daniela Brozzoni
parent 887e112e8f
commit 761189ab2b
No known key found for this signature in database
GPG Key ID: 7DE4F1FDCED0AB87

View File

@ -390,7 +390,11 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
let _inserted = self
.inner
.insert_spk((keychain.clone(), new_index), new_spk);
debug_assert!(_inserted, "must not have existing spk",);
debug_assert!(_inserted, "must not have existing spk");
debug_assert!(
has_wildcard || new_index == 0,
"non-wildcard descriptors must not iterate past index 0"
);
}
let _old_index = self.last_revealed.insert(keychain.clone(), target_index);