From 52f1c651a24eb3f74473a038c7167ae114fab409 Mon Sep 17 00:00:00 2001 From: pk910 Date: Fri, 25 Aug 2023 10:39:55 +0200 Subject: [PATCH] return proper v2 error when getting an error from the `/eth/v2/beacon/blocks` endpoint --- rpc/beaconapi.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpc/beaconapi.go b/rpc/beaconapi.go index 314db5eb..0423f416 100644 --- a/rpc/beaconapi.go +++ b/rpc/beaconapi.go @@ -234,11 +234,12 @@ func (bc *BeaconClient) GetBlockHeaderBySlot(slot uint64) (*rpctypes.StandardV1B func (bc *BeaconClient) GetBlockBodyByBlockroot(blockroot []byte) (*rpctypes.StandardV2BeaconBlockResponse, error) { resp, err := bc.get(fmt.Sprintf("%s/eth/v2/beacon/blocks/0x%x", bc.endpoint, blockroot)) + disperr := err if err != nil { resp, err = bc.get(fmt.Sprintf("%s/eth/v1/beacon/blocks/0x%x", bc.endpoint, blockroot)) } if err != nil { - return nil, fmt.Errorf("error retrieving block body for 0x%x: %v", blockroot, err) + return nil, fmt.Errorf("error retrieving block body for 0x%x: %v", blockroot, disperr) } var parsedResponse rpctypes.StandardV2BeaconBlockResponse