From: 志宇 Date: Tue, 9 Jan 2024 01:44:06 +0000 (+0800) Subject: feat(chain): debug_assert non-wildcard desc. to only cache index 0 X-Git-Tag: v1.0.0-alpha.4~6^2 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/struct.CodeLengthError.html?a=commitdiff_plain;h=761189ab2b679fbfee45b33435d66ed98a135e2a;p=bdk feat(chain): debug_assert non-wildcard desc. to only cache index 0 --- diff --git a/crates/chain/src/keychain/txout_index.rs b/crates/chain/src/keychain/txout_index.rs index 5c9eb084..a8955b8a 100644 --- a/crates/chain/src/keychain/txout_index.rs +++ b/crates/chain/src/keychain/txout_index.rs @@ -390,7 +390,11 @@ impl KeychainTxOutIndex { 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);