From 367f39db90da35c2fa879a0d5470fb7b848c8e0d Mon Sep 17 00:00:00 2001 From: Judd Keppel Date: Tue, 13 Feb 2024 16:02:57 -0600 Subject: [PATCH] Handle signer checkpoint interval check case where index is 0 --- src/bitcoin/signer.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bitcoin/signer.rs b/src/bitcoin/signer.rs index 8b220b7d..05eb9d7a 100644 --- a/src/bitcoin/signer.rs +++ b/src/bitcoin/signer.rs @@ -363,7 +363,11 @@ where let last_signed_btc_height: Option = self .client() .query(|app: InnerApp| { - Ok(app.bitcoin.checkpoints.get(index - 1)?.signed_at_btc_height) + Ok(app + .bitcoin + .checkpoints + .get(index.saturating_sub(1))? + .signed_at_btc_height) }) .await? .map(|v| v as u64);