@@ -50,13 +50,15 @@ type Vsp struct {
50
50
// Set by dcrwebapi each time info is successfully updated.
51
51
LastUpdated int64 `json:"lastupdated"`
52
52
// Retrieved from the /api/vspinfo.
53
- APIVersions []int64 `json:"apiversions"`
54
- FeePercentage float64 `json:"feepercentage"`
55
- Closed bool `json:"closed"`
56
- Voting int64 `json:"voting"`
57
- Voted int64 `json:"voted"`
58
- Revoked int64 `json:"revoked"`
59
- VspdVersion string `json:"vspdversion"`
53
+ APIVersions []int64 `json:"apiversions"`
54
+ FeePercentage float64 `json:"feepercentage"`
55
+ Closed bool `json:"closed"`
56
+ Voting int64 `json:"voting"`
57
+ Voted int64 `json:"voted"`
58
+ Revoked int64 `json:"revoked"`
59
+ VspdVersion string `json:"vspdversion"`
60
+ BlockHeight uint64 `json:"blockheight"`
61
+ EstimatedNetworkProportion float64 `json:"estimatednetworkproportion"`
60
62
}
61
63
type vspSet map [string ]Vsp
62
64
@@ -65,8 +67,7 @@ type Stakepool struct {
65
67
// APIEnabled defines if the api is enabled.
66
68
APIEnabled bool `json:"APIEnabled"`
67
69
68
- // APIVersionsSupported contains the collection of collection of API
69
- // versions supported.
70
+ // APIVersionsSupported contains the collection of API versions supported.
70
71
APIVersionsSupported []interface {} `json:"APIVersionsSupported"`
71
72
72
73
// Network defines the active network.
@@ -561,9 +562,12 @@ func vspStats(service *Service, url string) error {
561
562
voted , hasVoted := info ["voted" ]
562
563
revoked , hasRevoked := info ["revoked" ]
563
564
version , hasVersion := info ["vspdversion" ]
565
+ blockheight , hasBlockHeight := info ["blockheight" ]
566
+ networkproportion , hasnetworkproportion := info ["estimatednetworkproportion" ]
564
567
565
568
hasRequiredFields := hasAPIVersions && hasFeePercentage &&
566
- hasClosed && hasVoting && hasVoted && hasRevoked && hasVersion
569
+ hasClosed && hasVoting && hasVoted && hasRevoked && hasVersion &&
570
+ hasBlockHeight && hasnetworkproportion
567
571
568
572
if ! hasRequiredFields {
569
573
return fmt .Errorf ("%v: missing required fields: %+v" , infoURL , info )
@@ -580,6 +584,8 @@ func vspStats(service *Service, url string) error {
580
584
vsp .Voted = int64 (voted .(float64 ))
581
585
vsp .Revoked = int64 (revoked .(float64 ))
582
586
vsp .VspdVersion = version .(string )
587
+ vsp .BlockHeight = uint64 (blockheight .(float64 ))
588
+ vsp .EstimatedNetworkProportion = networkproportion .(float64 )
583
589
584
590
vsp .LastUpdated = time .Now ().Unix ()
585
591
0 commit comments