From 4a6bf38d674f45f04503b8ad689d56902d604e89 Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Wed, 20 Oct 2021 16:58:27 +0200 Subject: [PATCH] Fix getBlockProduction identity param --- rpc/client_test.go | 4 ++-- rpc/getBlockProduction.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rpc/client_test.go b/rpc/client_test.go index 3197b1f..7e6189d 100644 --- a/rpc/client_test.go +++ b/rpc/client_test.go @@ -590,8 +590,8 @@ func TestClient_GetBlockProductionWithOpts(t *testing.T) { Range: &SlotRangeRequest{ FirstSlot: firstSlot, LastSlot: &lastSlot, - Identity: &identity, }, + Identity: &identity, }, ) require.NoError(t, err) @@ -607,8 +607,8 @@ func TestClient_GetBlockProductionWithOpts(t *testing.T) { "range": map[string]interface{}{ "firstSlot": float64(firstSlot), "lastSlot": float64(lastSlot), - "identity": string(identity.String()), }, + "identity": identity.String(), }, }, }, diff --git a/rpc/getBlockProduction.go b/rpc/getBlockProduction.go index 08b6254..7ce4401 100644 --- a/rpc/getBlockProduction.go +++ b/rpc/getBlockProduction.go @@ -35,6 +35,11 @@ type GetBlockProductionOpts struct { // // This parameter is optional. Range *SlotRangeRequest + + // Only return results for this validator identity. + // + // This parameter is optional. + Identity *solana.PublicKey `json:"identity,omitempty"` } type SlotRangeRequest struct { @@ -46,11 +51,6 @@ type SlotRangeRequest struct { // // This parameter is optional. LastSlot *uint64 `json:"lastSlot,omitempty"` - - // Only return results for this validator identity. - // - // This parameter is optional. - Identity *solana.PublicKey `json:"identity,omitempty"` } // GetBlockProduction returns recent block production information from the current or previous epoch. @@ -81,11 +81,11 @@ func (cl *Client) GetBlockProductionWithOpts( if opts.Range.LastSlot != nil { rngObj["lastSlot"] = opts.Range.LastSlot } - if opts.Range.Identity != nil { - rngObj["identity"] = opts.Range.Identity - } obj["range"] = rngObj } + if opts.Identity != nil { + obj["identity"] = opts.Identity + } if len(obj) != 0 { params = append(params, obj) }