snapshots

package
v0.0.0-...-d82d076 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT, GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenRand

func GenRand(input []byte) (error, []byte)

Types

type CadNodeSnap

type CadNodeSnap struct {
	Number       uint64                     `json:"number"`
	Hash         common.Hash                `json:"hash"`
	CanAddresses []common.Address           `json:"cadaddresses"`
	VotePercents map[common.Address]float64 `json:"VotePercents"`
}

func CalcuCadNodeSnap

func CalcuCadNodeSnap(db hpbdb.Database, number uint64, hash common.Hash, headers []*types.Header, chain consensus.ChainReader) (*CadNodeSnap, error)

Get snap in community by elections,

func LoadCadNodeSnap

func LoadCadNodeSnap(db hpbdb.Database, hash common.Hash) (*CadNodeSnap, error)

load the node snapshot

func NewCadNodeSnap

func NewCadNodeSnap(number uint64, hash common.Hash, addresses []common.Address) *CadNodeSnap

func NewCadNodeSnapvote

func NewCadNodeSnapvote(number uint64, hash common.Hash, addresses []common.Address, VotePercents map[common.Address]float64) *CadNodeSnap

func (*CadNodeSnap) StoreCadNodeSnap

func (c *CadNodeSnap) StoreCadNodeSnap(db hpbdb.Database, hash common.Hash) error

store inserts the snapshot into the database.

type CadWinner

type CadWinner struct {
	NetworkId string         `json:"networkid"` // winner id
	Address   common.Address `json:"address"`   // winner address
	VoteIndex uint64         `json:"voteIndex"` // winner index
}

type HpbNodeSnap

type HpbNodeSnap struct {
	CheckPointNum  uint64                      `json:"checkPointNum"`
	CheckPointHash common.Hash                 `json:"checkPointHash"`
	Signers        map[common.Address]struct{} `json:"signers"`
	Recents        map[uint64]common.Address   `json:"recents"`
	Tally          map[common.Address]Tally    `json:"tally"`
	// contains filtered or unexported fields
}

func CalculateHpbSnap

func CalculateHpbSnap(index uint64, signatures *lru.ARCCache, config *config.PrometheusConfig, number uint64, latestCheckPointNum uint64, latestCheckPointHash common.Hash, chain consensus.ChainReader) (*HpbNodeSnap, error)

func LoadHistorysnap

func LoadHistorysnap(config *config.PrometheusConfig, sigcache *lru.ARCCache, db hpbdb.Database, hash common.Hash) (*HpbNodeSnap, error)

load the snapshots from database

func NewHistorysnap

func NewHistorysnap(config *config.PrometheusConfig, sigcache *lru.ARCCache, number uint64, checkPointNum uint64, checkPointHash common.Hash, signersHash []common.Address) *HpbNodeSnap

func (*HpbNodeSnap) CalculateBackupMiner

func (s *HpbNodeSnap) CalculateBackupMiner(number uint64, signer common.Address, headers []types.Header) bool

func (*HpbNodeSnap) CalculateCurrentMiner

func (s *HpbNodeSnap) CalculateCurrentMiner(number uint64, signer common.Address, chooseSigners []common.Address) (common.Address, bool)

func (*HpbNodeSnap) CalculateCurrentMinerorigin

func (s *HpbNodeSnap) CalculateCurrentMinerorigin(number uint64, signer common.Address) (common.Address, bool)

func (*HpbNodeSnap) GetHpbNodes

func (s *HpbNodeSnap) GetHpbNodes() []common.Address

non-sorted signer list

func (*HpbNodeSnap) GetOffset

func (s *HpbNodeSnap) GetOffset(number uint64, signer common.Address) uint64

func (*HpbNodeSnap) GetOffsethw

func (s *HpbNodeSnap) GetOffsethw(number uint64, signer common.Address, headers []*types.Header) (uint64, uint64, map[common.Address]uint64)

func (*HpbNodeSnap) Store

func (s *HpbNodeSnap) Store(hash common.Hash, db hpbdb.Database) error

store inserts the snapshot into the database.

func (*HpbNodeSnap) ValidVote

func (s *HpbNodeSnap) ValidVote(address common.Address) bool

type Tally

type Tally struct {
	CandAddress common.Address `json:"candAddress"`
	VoteNumbers *big.Int       `json:"voteNumbers"`
	VoteIndexs  *big.Int       `json:"voteIndexs"`
	VotePercent *big.Int       `json:"votePercent"`
}

Jump to

Keyboard shortcuts

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