diff --git a/pkg/tendermint/tendermint.go b/pkg/tendermint/tendermint.go index a0ad4d9..cd8bf31 100644 --- a/pkg/tendermint/tendermint.go +++ b/pkg/tendermint/tendermint.go @@ -44,6 +44,10 @@ func (rpc *RPC) GetAllProposals() ([]types.Proposal, error) { return nil, err } + if batchProposals.Message != "" { + return nil, errors.New(batchProposals.Message) + } + proposals = append(proposals, batchProposals.Proposals...) if len(batchProposals.Proposals) < PaginationLimit { break @@ -75,7 +79,7 @@ func (rpc *RPC) GetVote(proposal, voter string) (*types.VoteRPCResponse, error) } func (rpc *RPC) Get(url string, target interface{}) error { - errors := make([]error, len(rpc.URLs)) + nodeErrors := make([]error, len(rpc.URLs)) for index, lcd := range rpc.URLs { fullURL := lcd + url @@ -91,7 +95,7 @@ func (rpc *RPC) Get(url string, target interface{}) error { } rpc.Logger.Warn().Str("url", fullURL).Err(err).Msg("LCD request failed") - errors[index] = err + nodeErrors[index] = err } rpc.Logger.Warn().Str("url", url).Msg("All LCD requests failed") @@ -100,7 +104,7 @@ func (rpc *RPC) Get(url string, target interface{}) error { sb.WriteString("All LCD requests failed:\n") for index, url := range rpc.URLs { - sb.WriteString(fmt.Sprintf("#%d: %s -> %s\n", index+1, url, errors[index])) + sb.WriteString(fmt.Sprintf("#%d: %s -> %s\n", index+1, url, nodeErrors[index])) } return fmt.Errorf(sb.String()) diff --git a/pkg/types/responses.go b/pkg/types/responses.go index 3f4956e..c6c9899 100644 --- a/pkg/types/responses.go +++ b/pkg/types/responses.go @@ -23,6 +23,8 @@ type ProposalContent struct { } type ProposalsRPCResponse struct { + Code int64 `json:"code"` + Message string `json:"message"` Proposals []Proposal `json:"proposals"` }