consensus

package
v0.0.0-...-041d6b2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateStatusUnknown = iota

	StateStatusPrePrepared
	StateStatusPrepared
	StateStatusCommited
)

Variables

View Source
var (
	ErrNoAcceptedBlocks = errors.New("there is no accepted blocks")
)

Functions

func NewMessage

func NewMessage(cmsg *types2.ConsensusMessage, privKey crypto.PrivKey) (*pubsub.PubSubMessage, error)

Types

type ConsensusHandler

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

func NewConsensusHandler

func NewConsensusHandler(
	bus EventBus.Bus,
	psb *pubsub.PubSubRouter,
	privKey crypto.PrivKey,
	ethereumClient ethclient.EthereumSideAPI,
	miner *blockchain.Miner,
	bc *blockchain.BlockChain,
	bp *ConsensusManager,
	db *drand2.DrandBeacon,
	mempool *pool.Mempool,
	h host.Host,
) *ConsensusHandler

type ConsensusInfo

type ConsensusInfo struct {
	Blockhash  []byte
	Block      *types.Block
	State      State
	MessageLog *ConsensusMessageLog
}

type ConsensusManager

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

func NewConsensusManager

func NewConsensusManager(mp *pool.Mempool, bus EventBus.Bus, cfg *config.Config) (*ConsensusManager, error)

func (*ConsensusManager) GetAllBlocksWithCommit

func (crp *ConsensusManager) GetAllBlocksWithCommit() []*ConsensusInfo

func (*ConsensusManager) InsertMessageIntoLog

func (crp *ConsensusManager) InsertMessageIntoLog(cmsg *types2.ConsensusMessage) error

func (*ConsensusManager) Prune

func (crp *ConsensusManager) Prune()

Prune cleans known blocks list. It is called when new consensus round starts.

type ConsensusMessageLog

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

func NewConsensusMessageLog

func NewConsensusMessageLog() *ConsensusMessageLog

func (*ConsensusMessageLog) AddMessage

func (ml *ConsensusMessageLog) AddMessage(msg *types2.ConsensusMessage) bool

func (*ConsensusMessageLog) Exists

func (*ConsensusMessageLog) Get

type ConsensusValidator

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

func (*ConsensusValidator) Valid

type Dispute

type Dispute struct {
	Dhash            [32]byte
	RequestID        *big.Int
	Miner            common.Address
	DisputeInitiator common.Address
	Timestamp        int64
	Voted            bool
	Finished         bool // if we are dispute initiator
}

type DisputeManager

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

func (*DisputeManager) Run

func (dm *DisputeManager) Run(ctx context.Context)

type State

type State uint8

type Submission

type Submission struct {
	ReqID     *big.Int
	Data      []byte
	Timestamp int64
	Checked   bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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