From b353601a311602b0eaa47213cfd18cdd267f15c5 Mon Sep 17 00:00:00 2001 From: Filipe Azevedo Date: Mon, 13 May 2024 16:06:14 +0100 Subject: [PATCH] fix hash_as_h256? --- graph/src/blockchain/types.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/graph/src/blockchain/types.rs b/graph/src/blockchain/types.rs index 18d03b390ba..7caac94c246 100644 --- a/graph/src/blockchain/types.rs +++ b/graph/src/blockchain/types.rs @@ -159,6 +159,12 @@ impl BlockPtr { // // workaround for arweave pub fn hash_as_h256(&self) -> H256 { + let slice = self.hash_slice(); + + if slice.is_empty() { + return H256::zero(); + } + H256::from_slice(&self.hash_slice()[..32]) }