poa

package
v0.0.0-...-143af32 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSecrets = []string{
	"node1",
	"node2",
	"node3",
}

Functions

func InitDefaultKeypairs

func InitDefaultKeypairs(idx int) (PubKey, PrivKey, []ValidatorInfo)

Types

type Poa

type Poa struct {
	*Tripod
	// contains filtered or unexported fields
}

func NewPoa

func NewPoa(cfg *PoaConfig) *Poa

func (*Poa) AmILeader

func (h *Poa) AmILeader(blockHeight BlockNum) bool

func (*Poa) CheckTxn

func (h *Poa) CheckTxn(txn *SignedTxn) error

func (*Poa) CompeteLeader

func (h *Poa) CompeteLeader(blockHeight BlockNum) Address

func (*Poa) EndBlock

func (h *Poa) EndBlock(block *Block)

func (*Poa) FinalizeBlock

func (h *Poa) FinalizeBlock(block *Block)

func (*Poa) InitChain

func (h *Poa) InitChain()

func (*Poa) IsValidator

func (h *Poa) IsValidator(addr Address) bool

func (*Poa) LocalAddress

func (h *Poa) LocalAddress() Address

func (*Poa) StartBlock

func (h *Poa) StartBlock(block *Block)

func (*Poa) ValidatorsP2pID

func (h *Poa) ValidatorsP2pID() (peers []peer.ID)

func (*Poa) VerifyBlock

func (h *Poa) VerifyBlock(block *Block) bool

type PoaConfig

type PoaConfig struct {
	KeyType string `toml:"key_type"`
	// secret for generating keypair.
	MySecret   string           `toml:"my_secret"`
	Validators []*ValidatorConf `toml:"validators"`
	// block out interval, seconds
	BlockInterval int `toml:"block_interval"`
	// the number of packing txns from txpool, default 5000
	PackNum uint64 `toml:"pack_num"`
}

func DefaultCfg

func DefaultCfg(idx int) *PoaConfig

type ValidatorConf

type ValidatorConf struct {
	Pubkey string `toml:"pubkey"`
	P2pIp  string `toml:"p2p_ip"`
}

type ValidatorInfo

type ValidatorInfo struct {
	Pubkey PubKey
	P2pID  peer.ID
}

Jump to

Keyboard shortcuts

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