Skip to content

Commit 9718d5d

Browse files
committed
fix(beacon_client): fix path building error when fetching blocks by their hash
1 parent 23d4323 commit 9718d5d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: src/clients/beacon/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ impl BeaconClient {
3838
}
3939

4040
pub async fn get_block(&self, block_id: &BlockId) -> ClientResult<Option<Block>> {
41+
let block_id = match block_id {
42+
BlockId::Hash(hash) => format!("0x{:x}", hash),
43+
BlockId::Slot(slot) => slot.to_string(),
44+
block_id => block_id.to_string(),
45+
};
46+
4147
let path = format!("v2/beacon/blocks/{block_id}");
4248
let url = self.base_url.join(path.as_str())?;
4349

0 commit comments

Comments
 (0)