Skip to content

Commit

Permalink
rpcserver: Decouple RPC agenda info status strings.
Browse files Browse the repository at this point in the history
Similar to the case that previously existed for getblockchainfo,
currently, the getvoteinfo RPC implementation directly returns the
internal threshold state strings defined in blockchain.  This is not
ideal since it means that any changes to the internal implementation
could inadvertently change the RPC results without being noticed.

Further, the blockchain package is now internal which means external
callers don't have access to those constants.

Consequently, this makes the same change to getvoteinfo as was
previously made to getblockchaininfo to decouple the agenda status
strings by converting the internal blockchain threshold state to use the
agenda status string constants defined in the rpc/jsonrpc/types module.
  • Loading branch information
davecgh committed Mar 2, 2023
1 parent 961b019 commit e75364d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/rpcserver/rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -3425,7 +3425,7 @@ func handleGetVoteInfo(_ context.Context, s *Server, cmd interface{}) (interface
Choices: make([]types.Choice, 0, len(agenda.Vote.Choices)),
StartTime: agenda.StartTime,
ExpireTime: agenda.ExpireTime,
Status: state.String(),
Status: thresholdStateToAgendaStatus(state),
}

// Handle choices.
Expand Down

0 comments on commit e75364d

Please sign in to comment.