Documentation ¶
Index ¶
- Constants
- func DecodeValidators(encoded []byte, validators *Validators) error
- type Blockchain
- type BlockchainInfo
- type PersistedState
- type Root
- type Tip
- func (t *Tip) AppHashAfterLastBlock() []byte
- func (t *Tip) ChainID() string
- func (t *Tip) IterateValidators(iter func(publicKey crypto.PublicKey, power uint64) (stop bool)) (stopped bool)
- func (t *Tip) LastBlockHash() []byte
- func (t *Tip) LastBlockHeight() uint64
- func (t *Tip) LastBlockTime() time.Time
- func (t *Tip) NumValidators() int
- type TipInfo
- type Validators
- func (vs *Validators) AddPower(publicKey crypto.PublicKey, power uint64) error
- func (vs *Validators) AlterPower(publicKey crypto.PublicKey, power uint64) error
- func (vs *Validators) Encode() []byte
- func (vs *Validators) Iterate(iter func(publicKey crypto.PublicKey, power uint64) (stop bool)) (stopped bool)
- func (vs *Validators) Length() int
- func (vs *Validators) SubtractPower(publicKey crypto.PublicKey, power uint64) error
- func (vs *Validators) TotalPower() uint64
- type ValidatorsWindow
Constants ¶
View Source
const DefaultValidatorsWindowSize = 10
Blocks to average validator power over
Variables ¶
This section is empty.
Functions ¶
func DecodeValidators ¶ added in v0.19.0
func DecodeValidators(encoded []byte, validators *Validators) error
Decodes validators encoded with Encode - expects the exact encoded size with no trailing bytes
Types ¶
type Blockchain ¶ added in v0.18.0
func LoadOrNewBlockchain ¶ added in v0.18.0
func LoadOrNewBlockchain(db dbm.DB, genesisDoc *genesis.GenesisDoc, logger *logging.Logger) (*Blockchain, error)
func (*Blockchain) CommitBlock ¶ added in v0.19.0
func (bc *Blockchain) CommitBlock(blockTime time.Time, blockHash, appHash []byte) error
func (*Blockchain) Encode ¶ added in v0.19.0
func (bc *Blockchain) Encode() ([]byte, error)
type BlockchainInfo ¶ added in v0.19.0
type BlockchainInfo interface { TipInfo GenesisHash() []byte GenesisDoc() genesis.GenesisDoc }
type PersistedState ¶ added in v0.18.0
type PersistedState struct { AppHashAfterLastBlock []byte LastBlockHeight uint64 GenesisDoc genesis.GenesisDoc }
func Decode ¶ added in v0.18.0
func Decode(encodedState []byte) (*PersistedState, error)
type Root ¶ added in v0.18.0
type Root struct {
// contains filtered or unexported fields
}
func NewRoot ¶ added in v0.18.0
func NewRoot(genesisDoc *genesis.GenesisDoc) *Root
func (*Root) GenesisDoc ¶ added in v0.18.0
func (r *Root) GenesisDoc() genesis.GenesisDoc
func (*Root) GenesisHash ¶ added in v0.18.0
type Tip ¶ added in v0.18.0
type Tip struct {
// contains filtered or unexported fields
}
func (*Tip) AppHashAfterLastBlock ¶ added in v0.18.0
func (*Tip) IterateValidators ¶ added in v0.19.0
func (*Tip) LastBlockHash ¶ added in v0.18.0
func (*Tip) LastBlockHeight ¶ added in v0.18.0
func (*Tip) LastBlockTime ¶ added in v0.18.0
func (*Tip) NumValidators ¶ added in v0.19.0
type Validators ¶ added in v0.19.0
type Validators struct {
// contains filtered or unexported fields
}
A Validator multiset
func NewValidators ¶ added in v0.19.0
func NewValidators() Validators
func (*Validators) AddPower ¶ added in v0.19.0
func (vs *Validators) AddPower(publicKey crypto.PublicKey, power uint64) error
func (*Validators) AlterPower ¶ added in v0.19.0
func (vs *Validators) AlterPower(publicKey crypto.PublicKey, power uint64) error
Add the power of a validator
func (*Validators) Encode ¶ added in v0.19.0
func (vs *Validators) Encode() []byte
Uses the fixed width public key encoding to
func (*Validators) Iterate ¶ added in v0.19.0
func (vs *Validators) Iterate(iter func(publicKey crypto.PublicKey, power uint64) (stop bool)) (stopped bool)
Iterates over validators sorted by address
func (*Validators) Length ¶ added in v0.19.0
func (vs *Validators) Length() int
func (*Validators) SubtractPower ¶ added in v0.19.0
func (vs *Validators) SubtractPower(publicKey crypto.PublicKey, power uint64) error
func (*Validators) TotalPower ¶ added in v0.19.0
func (vs *Validators) TotalPower() uint64
type ValidatorsWindow ¶ added in v0.19.0
type ValidatorsWindow struct { Buckets []Validators Total Validators // contains filtered or unexported fields }
func NewValidatorsWindow ¶ added in v0.19.0
func NewValidatorsWindow(size int) ValidatorsWindow
Provides a sliding window over the last size buckets of validator power changes
func (*ValidatorsWindow) AlterPower ¶ added in v0.19.0
func (vw *ValidatorsWindow) AlterPower(publicKey crypto.PublicKey, power uint64) error
Updates the current head bucket (accumulator)
func (*ValidatorsWindow) CommitInto ¶ added in v0.19.0
func (vw *ValidatorsWindow) CommitInto(validatorsToUpdate *Validators) error
Click to show internal directories.
Click to hide internal directories.