From 7fbf825b5095900a5356bfb4fcfcef7c9f373dc3 Mon Sep 17 00:00:00 2001 From: Angel Valkov Date: Fri, 3 Jan 2025 13:30:36 +0200 Subject: [PATCH] Fix milestone no-ack parsing --- consensus/bor/heimdall/client.go | 6 +++--- consensus/bor/heimdall/milestone/milestone.go | 14 ++------------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/consensus/bor/heimdall/client.go b/consensus/bor/heimdall/client.go index 67ad49a0e3..9fccdd2e3a 100644 --- a/consensus/bor/heimdall/client.go +++ b/consensus/bor/heimdall/client.go @@ -85,7 +85,7 @@ const ( fetchMilestone = "/milestone/latest" fetchMilestoneCount = "/milestone/count" - fetchLastNoAckMilestone = "/milestone/lastNoAck" + fetchLastNoAckMilestone = "/milestone/last-no-ack" fetchNoAckMilestone = "/milestone/noAck/%s" fetchMilestoneID = "/milestone/ID/%s" @@ -244,7 +244,7 @@ func (h *HeimdallClient) FetchLastNoAckMilestone(ctx context.Context) (string, e return "", err } - return response.Result.Result, nil + return response.Result, nil } // FetchNoAckMilestone fetches the last no-ack-milestone from heimdall @@ -261,7 +261,7 @@ func (h *HeimdallClient) FetchNoAckMilestone(ctx context.Context, milestoneID st return err } - if !response.Result.Result { + if !response.Result { return fmt.Errorf("%w: milestoneID %q", ErrNotInRejectedList, milestoneID) } diff --git a/consensus/bor/heimdall/milestone/milestone.go b/consensus/bor/heimdall/milestone/milestone.go index 3a4e70c9a5..65e7c8d6dd 100644 --- a/consensus/bor/heimdall/milestone/milestone.go +++ b/consensus/bor/heimdall/milestone/milestone.go @@ -76,22 +76,12 @@ type MilestoneCountResponse struct { Result MilestoneCount `json:"result"` } -type MilestoneLastNoAck struct { - Result string `json:"result"` -} - type MilestoneLastNoAckResponse struct { - Height string `json:"height"` - Result MilestoneLastNoAck `json:"result"` -} - -type MilestoneNoAck struct { - Result bool `json:"result"` + Result string `json:"result"` } type MilestoneNoAckResponse struct { - Height string `json:"height"` - Result MilestoneNoAck `json:"result"` + Result bool `json:"result"` } type MilestoneID struct {