Skip to content

Commit e62476c

Browse files
committed
dcrjson: Ready GetStakeInfoResult for SPV wallets.
This change makes the following fields omitempty so they can be ignored by SPV wallets: * poolsize * allmempooltix * live * proportionlive * missed * proportionmissed * expired As a side-effect, non-SPV wallets will also omit these fields from the result if the value is zero. The following counts remain: * ownmempooltix * immature * voted * revoked And two new fields have been added to allow SPV wallets to provide a fuller picture of the wallet's ticket state counts: * unspent * unspentexpired The `unspent` field describes the number of tickets that have gone live and have not been spent by a vote or revocation. The `unspentexpired` field describes the number of unspent tickets that must certainly be revoked as they have not been spent by a vote and have passed the expiry period. These tickets may have been called and missed, or actually expired, but a SPV wallet is aware that they must be revoked as they cannot possibly be live. These changes are being made due to SPV wallets being unaware of what state a matured ticket is in (whether live, picked, or missed) and because SPV wallets do not know the ticket pool size or the number of all unmined tickets.
1 parent 90adb7c commit e62476c

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

dcrjson/walletsvrresults.go

+19-14
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,25 @@ type GetMultisigOutInfoResult struct {
6161
// GetStakeInfoResult models the data returned from the getstakeinfo
6262
// command.
6363
type GetStakeInfoResult struct {
64-
BlockHeight int64 `json:"blockheight"`
65-
PoolSize uint32 `json:"poolsize"`
66-
Difficulty float64 `json:"difficulty"`
67-
AllMempoolTix uint32 `json:"allmempooltix"`
68-
OwnMempoolTix uint32 `json:"ownmempooltix"`
69-
Immature uint32 `json:"immature"`
70-
Live uint32 `json:"live"`
71-
ProportionLive float64 `json:"proportionlive"`
72-
Voted uint32 `json:"voted"`
73-
TotalSubsidy float64 `json:"totalsubsidy"`
74-
Missed uint32 `json:"missed"`
75-
ProportionMissed float64 `json:"proportionmissed"`
76-
Revoked uint32 `json:"revoked"`
77-
Expired uint32 `json:"expired"`
64+
BlockHeight int64 `json:"blockheight"`
65+
Difficulty float64 `json:"difficulty"`
66+
TotalSubsidy float64 `json:"totalsubsidy"`
67+
68+
OwnMempoolTix uint32 `json:"ownmempooltix"`
69+
Immature uint32 `json:"immature"`
70+
Unspent uint32 `json:"unspent"`
71+
Voted uint32 `json:"voted"`
72+
Revoked uint32 `json:"revoked"`
73+
UnspentExpired uint32 `json:"unspentexpired"`
74+
75+
// Not available to SPV wallets
76+
PoolSize uint32 `json:"poolsize,omitempty"`
77+
AllMempoolTix uint32 `json:"allmempooltix,omitempty"`
78+
Live uint32 `json:"live,omitempty"`
79+
ProportionLive float64 `json:"proportionlive,omitempty"`
80+
Missed uint32 `json:"missed,omitempty"`
81+
ProportionMissed float64 `json:"proportionmissed,omitempty"`
82+
Expired uint32 `json:"expired,omitempty"`
7883
}
7984

8085
// GetTicketsResult models the data returned from the gettickets

0 commit comments

Comments
 (0)