Skip to content

Commit

Permalink
rpc: explicitly specify immature & live tickets in StakePoolUserInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
beansgum authored and jrick committed Jun 11, 2019
1 parent 958ad8b commit 8b51e95
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rpc/legacyrpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -2448,13 +2448,20 @@ func (s *Server) stakePoolUserInfo(ctx context.Context, icmd interface{}) (inter
resp := new(types.StakePoolUserInfoResult)
resp.Tickets = make([]types.PoolUserTicket, 0, len(spui.Tickets))
resp.InvalidTickets = make([]string, 0, len(spui.InvalidTickets))
_, height := w.MainChainTip()
for _, ticket := range spui.Tickets {
var ticketRes types.PoolUserTicket

status := ""
switch ticket.Status {
case udb.TSImmatureOrLive:
status = "live"
maturedHeight := int32(ticket.HeightTicket + uint32(w.ChainParams().TicketMaturity) + 1)

if height >= maturedHeight {
status = "live"
} else {
status = "immature"
}
case udb.TSVoted:
status = "voted"
case udb.TSMissed:
Expand Down

0 comments on commit 8b51e95

Please sign in to comment.