validator

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package validator provides functionality for managing validator information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

The Validator struct represents a validator object.

func FromBytes

func FromBytes(data []byte) (*Validator, error)

FromBytes constructs a new validator from raw byte data.

func NewValidator

func NewValidator(publicKey *bls.PublicKey, number int32) *Validator

NewValidator constructs a new validator from the given public key and number.

func (*Validator) AddToStake

func (val *Validator) AddToStake(amt amount.Amount)

AddToStake adds the given amount to the validator's stake.

func (*Validator) Address

func (val *Validator) Address() crypto.Address

Address returns the address of the validator.

func (*Validator) Bytes

func (val *Validator) Bytes() ([]byte, error)

Bytes returns the serialized byte representation of the validator.

func (*Validator) Clone added in v0.12.0

func (val *Validator) Clone() *Validator

Clone creates a deep copy of the validator.

func (*Validator) DelegateExpired added in v1.13.0

func (val *Validator) DelegateExpired(height uint32) bool

DelegateExpired returns true if delegation has expired at the given height.

func (*Validator) DelegateExpiry added in v1.13.0

func (val *Validator) DelegateExpiry() uint32

DelegateExpiry returns the block height at which delegation expires (0 = no expiry).

func (*Validator) DelegateOwner added in v1.13.0

func (val *Validator) DelegateOwner() crypto.Address

DelegateOwner returns the stake owner account address for delegated validators.

func (*Validator) DelegateShare added in v1.13.0

func (val *Validator) DelegateShare() amount.Amount

DelegateShare returns the stake owner's reward share (in nano PAC) for delegated validators.

func (*Validator) Hash

func (val *Validator) Hash() hash.Hash

Hash calculates and returns the hash of the validator.

func (*Validator) IsDelegated added in v1.13.0

func (val *Validator) IsDelegated() bool

IsDelegated returns true if the validator has delegation (stake owner != operator).

func (*Validator) IsUnbonded added in v1.10.0

func (val *Validator) IsUnbonded() bool

IsUnbonded returns true if the validator is unbonded.

func (*Validator) LastBondingHeight

func (val *Validator) LastBondingHeight() uint32

LastBondingHeight returns the last height in which the validator bonded stake.

func (*Validator) LastSortitionHeight added in v0.15.0

func (val *Validator) LastSortitionHeight() uint32

LastSortitionHeight returns the last height in which the validator evaluated sortition.

func (*Validator) Number

func (val *Validator) Number() int32

Number returns the number of the validator.

func (*Validator) Power

func (val *Validator) Power() int64

Power returns the power of the validator.

func (*Validator) ProtocolVersion added in v1.9.0

func (val *Validator) ProtocolVersion() protocol.Version

ProtocolVersion returns the protocol version of the validator.

func (*Validator) PublicKey

func (val *Validator) PublicKey() *bls.PublicKey

PublicKey returns the public key of the validator.

func (*Validator) SerializeSize

func (val *Validator) SerializeSize() int

SerializeSize returns the size in bytes required to serialize the validator.

func (*Validator) SetDelegation added in v1.13.0

func (val *Validator) SetDelegation(owner crypto.Address, share amount.Amount, expiry uint32)

SetDelegation sets the delegation fields (PIP-49). Use zero owner to clear delegation.

func (*Validator) Stake

func (val *Validator) Stake() amount.Amount

Stake returns the stake of the validator.

func (*Validator) SubtractFromStake

func (val *Validator) SubtractFromStake(amt amount.Amount)

SubtractFromStake subtracts the given amount from the validator's stake.

func (*Validator) UnbondingHeight

func (val *Validator) UnbondingHeight() uint32

UnbondingHeight returns the last height in which the validator unbonded stake.

func (*Validator) UpdateLastBondingHeight

func (val *Validator) UpdateLastBondingHeight(height uint32)

UpdateLastBondingHeight updates the last height at which the validator bonded some stakes.

func (*Validator) UpdateLastSortitionHeight added in v0.15.0

func (val *Validator) UpdateLastSortitionHeight(height uint32)

UpdateLastSortitionHeight updates the last height at which the validator performed a valid sortition.

func (*Validator) UpdateProtocolVersion added in v1.9.0

func (val *Validator) UpdateProtocolVersion(ver protocol.Version)

UpdateProtocolVersion updates the protocol version of the validator.

func (*Validator) UpdateUnbondingHeight

func (val *Validator) UpdateUnbondingHeight(height uint32)

UpdateUnbondingHeight updates the unbonding height for the validator.

Jump to

Keyboard shortcuts

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