privval

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyFile is Tendermint's default file name for the private validator's keys.
	KeyFile = "priv_validator_key.json"

	// StateFile is Tendermint's default file name for the private validator's state.
	StateFile = "priv_validator_state.json"
)
View Source
const (
	// DefaultHTTPPort is the default port which SCFilePV's HTTP server listens on.
	DefaultHTTPPort = 8080
)

Variables

View Source
var (
	// ErrRankObsolete is returned if the requested vote height is too far ahead of the last
	// block the validator signed. The gap must be at least {threshold} blocks.
	ErrRankObsolete = errors.New("at least one threshold was exceeded between requested vote height and last_signed_height")
)

Functions

func HandleRequest

func HandleRequest(ctx context.Context, msg *tm_privvalproto.Message, pv *SCFilePV) (*tm_privvalproto.Message, error)

HandleRequest handles all incoming requests from the validator.

func KeyFilePath

func KeyFilePath(cfgDir string) string

KeyFilePath returns the absolute path to the priv_validator_key.json file.

func StateFilePath

func StateFilePath(cfgDir string) string

StateFilePath returns the absolute path to the priv_validator_state.json file.

Types

type SCFilePV

type SCFilePV struct {
	types.BaseService
	types.BaseSignCtrled

	Logger     *types.SyncLogger
	Config     config.Config
	State      config.State
	TMFilePV   tm_types.PrivValidator
	SecretConn net.Conn
	HTTP       *http.Server
	Gauges     types.Gauges
}

SCFilePV is a wrapper for tm_privval.FilePV. Implements the SignCtrled interface by embedding BaseSignCtrled. Implements the Service interface by embedding BaseService.

func NewSCFilePV

func NewSCFilePV(logger *types.SyncLogger, cfg config.Config, state config.State, tmpv tm_types.PrivValidator, http *http.Server) *SCFilePV

NewSCFilePV creates a new instance of SCFilePV.

func (*SCFilePV) OnMissedTooMany

func (pv *SCFilePV) OnMissedTooMany()

OnMissedTooMany sets the prometheus gauge for the validator's counter for missed blocks in a row. Implements the SignCtrled interface.

func (*SCFilePV) OnPromote

func (pv *SCFilePV) OnPromote()

OnPromote sets the prometheus gauge for the validator's rank. Implements the SignCtrled interface.

func (*SCFilePV) OnStart

func (pv *SCFilePV) OnStart() (err error)

OnStart starts the main loop of the SignCtrled PrivValidator. Implements the Service interface.

func (*SCFilePV) OnStop

func (pv *SCFilePV) OnStop() error

OnStop terminates the main loop of the SignCtrled PrivValidator. Implements the Service interface.

func (*SCFilePV) StartHTTPServer

func (pv *SCFilePV) StartHTTPServer() error

StartHTTPServer starts an HTTP server.

type StatusResponse

type StatusResponse struct {
	Height    int64 `json:"height"`
	Rank      int   `json:"rank"`
	SetSize   int   `json:"set_size"`
	Counter   int   `json:"counter"`
	Threshold int   `json:"threshold"`
}

StatusResponse defines the response JSON for status requests.

func GetStatus

func GetStatus() (*StatusResponse, error)

GetStatus retrieves the node's status in terms of current height, rank and blocks missed in a row.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL