base

package
v0.0.0-...-d9e9996 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsensusInterface

type ConsensusInterface interface {
	Type() string
	Version() int64
	// 用于回滚或者重启时一些临时数据的恢复
	InitCurrent(block *pb.InternalBlock) error
	Configure(xlog log.Logger, cfg *config.NodeConfig, consCfg map[string]interface{},
		extParams map[string]interface{}) error
	// CompeteMaster 返回是否为矿工以及是否需要进行SyncBlock
	CompeteMaster(height int64) (bool, bool)
	CheckMinerMatch(header *pb.Header, in *pb.InternalBlock) (bool, error)
	// 开始挖矿前进行相应的处理
	ProcessBeforeMiner(timestamp int64) (map[string]interface{}, bool)
	// 用于确认块后进行相应的处理
	ProcessConfirmBlock(block *pb.InternalBlock) error

	// Get current core miner info
	GetCoreMiners() []*MinerInfo

	// Get consensus status
	GetStatus() *ConsensusStatus
}

ConsensusInterface is the interface of consensus

type ConsensusStatus

type ConsensusStatus struct {
	Proposer string
	Term     int64
	BlockNum int64
}

ConsensusStatus define the status of Consensus

type MinerInfo

type MinerInfo struct {
	Address  string // AmpChain address
	PeerInfo string // peer info(in most cases is the network address)
}

MinerInfo defines the essential info of miner

type MinersChangedEvent

type MinersChangedEvent struct {
	BcName        string
	CurrentMiners []*MinerInfo
	NextMiners    []*MinerInfo
}

MinersChangedEvent define the information of miners would be changed. this event would be fired when DPoS proposers initialized or next round proposers are selected.

Jump to

Keyboard shortcuts

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