From 761189ab2b679fbfee45b33435d66ed98a135e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=97=E5=AE=87?= Date: Tue, 9 Jan 2024 09:44:06 +0800 Subject: [PATCH] feat(chain): debug_assert non-wildcard desc. to only cache index 0 --- crates/chain/src/keychain/txout_index.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);