vspd/webapi/vspinfo.go
Jamie Holdstock d1a838bf7f Add vspclosedmsg config.
If vspclosed is set to true, the provided message will be displayed on the webpage and returned by the status API endpoint.
2021-06-10 09:45:22 +08:00

33 lines
916 B
Go

// Copyright (c) 2020 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/version"
"github.com/gin-gonic/gin"
)
// vspInfo is the handler for "GET /api/v3/vspinfo".
func vspInfo(c *gin.Context) {
cachedStats := getVSPStats()
sendJSONResponse(vspInfoResponse{
APIVersions: []int64{3},
Timestamp: time.Now().Unix(),
PubKey: signPubKey,
FeePercentage: cfg.VSPFee,
Network: cfg.NetParams.Name,
VspClosed: cfg.VspClosed,
VspClosedMsg: cfg.VspClosedMsg,
VspdVersion: version.String(),
Voting: cachedStats.Voting,
Voted: cachedStats.Voted,
Revoked: cachedStats.Revoked,
BlockHeight: cachedStats.BlockHeight,
NetworkProportion: cachedStats.NetworkProportion,
}, c)
}