From dd28a4ca730f5d213861ab23ca012896c1d19c34 Mon Sep 17 00:00:00 2001 From: Emilia Hane Date: Fri, 12 Apr 2024 15:34:42 +0200 Subject: [PATCH] fix(cmd): get tip block (#7591) --- crates/net/downloaders/src/file_client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/net/downloaders/src/file_client.rs b/crates/net/downloaders/src/file_client.rs index 8f91220903..1f09ad787b 100644 --- a/crates/net/downloaders/src/file_client.rs +++ b/crates/net/downloaders/src/file_client.rs @@ -116,7 +116,7 @@ impl FileClient { /// Get the tip hash of the chain. pub fn tip(&self) -> Option { - self.headers.get(&(self.headers.len() as u64)).map(|h| h.hash_slow()) + self.headers.get(&((self.headers.len() - 1) as u64)).map(|h| h.hash_slow()) } /// Returns the highest block number of this client has or `None` if empty