vspd/internal/webapi/vspinfo.go
jholdstock ba5b1b2990 types: Remove Revoked from VSP info response.
This was marked as deprecated in the previous release and is now being
removed.
2024-05-29 11:02:50 +01:00

38 lines
1.2 KiB
Go

// Copyright (c) 2020-2024 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package webapi
import (
"time"
"github.com/decred/vspd/internal/version"
"github.com/decred/vspd/types/v3"
"github.com/gin-gonic/gin"
)
// vspInfo is the handler for "GET /api/v3/vspinfo".
func (w *WebAPI) vspInfo(c *gin.Context) {
cachedStats := c.MustGet(cacheKey).(cacheData)
w.sendJSONResponse(types.VspInfoResponse{
APIVersions: []int64{3},
Timestamp: time.Now().Unix(),
PubKey: w.signPubKey,
FeePercentage: w.cfg.VSPFee,
Network: w.cfg.Network.Name,
VspClosed: w.cfg.VspClosed,
VspClosedMsg: w.cfg.VspClosedMsg,
VspdVersion: version.String(),
Voting: cachedStats.Voting,
Voted: cachedStats.Voted,
TotalVotingWallets: cachedStats.TotalVotingWallets,
VotingWalletsOnline: cachedStats.VotingWalletsOnline,
Expired: cachedStats.Expired,
Missed: cachedStats.Missed,
BlockHeight: cachedStats.BlockHeight,
NetworkProportion: cachedStats.NetworkProportion,
}, c)
}