Skip to content

Commit

Permalink
allow getting version of clients that do not follow the spec
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Dec 21, 2023
1 parent ca8e0a0 commit 8e9479b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pkg/coordinator/clients/consensus/rpc/beaconapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,21 @@ func (bc *BeaconClient) GetNodeSyncStatus(ctx context.Context) (*SyncStatus, err
return &syncStatus, nil
}

type apiNodeVersion struct {
Data struct {
Version string `json:"version"`
} `json:"data"`
}

func (bc *BeaconClient) GetNodeVersion(ctx context.Context) (string, error) {
provider, isProvider := bc.clientSvc.(eth2client.NodeVersionProvider)
if !isProvider {
return "", fmt.Errorf("get node version not supported")
}
var nodeVersion apiNodeVersion

result, err := provider.NodeVersion(ctx)
err := bc.getJSON(ctx, fmt.Sprintf("%s/eth/v1/node/version", bc.endpoint), &nodeVersion)
if err != nil {
return "", err
return "", fmt.Errorf("error retrieving node version: %v", err)
}

return result, nil
return nodeVersion.Data.Version, nil
}

func (bc *BeaconClient) GetConfigSpecs(ctx context.Context) (map[string]interface{}, error) {
Expand Down

0 comments on commit 8e9479b

Please sign in to comment.