moca

package
v0.8.1-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGetConsensusStateMessage

func NewGetConsensusStateMessage() (*pb.UnsignedMessage, error)

NewGetConsensusStateMessage creates a GET_CONSENSUS_STATE message

func NewGetConsensusStateReply

func NewGetConsensusStateReply(ledgerHeight uint32, ledgerBlockHash common.Uint256, consensusHeight uint32, syncState pb.SyncState) (*pb.UnsignedMessage, error)

NewGetConsensusStateReply creates a GET_CONSENSUS_STATE_REPLY message in respond to GET_CONSENSUS_STATE message

func NewIHaveBlockProposalMessage

func NewIHaveBlockProposalMessage(height uint32, blockHash common.Uint256) (*pb.UnsignedMessage, error)

NewIHaveBlockProposalMessage creates a I_HAVE_BLOCK_PROPOSAL message

func NewRequestBlockProposalMessage

func NewRequestBlockProposalMessage(blockHash common.Uint256) (*pb.UnsignedMessage, error)

NewRequestBlockProposalMessage creates a REQUEST_BLOCK_PROPOSAL message to request a block

func NewRequestBlockProposalReply

func NewRequestBlockProposalReply(block *ledger.Block) (*pb.UnsignedMessage, error)

NewRequestBlockProposalReply creates a REQUEST_BLOCK_PROPOSAL_REPLY message in respond to REQUEST_BLOCK_PROPOSAL message to send a block

func NewVoteMessage

func NewVoteMessage(height uint32, blockHash common.Uint256) (*pb.UnsignedMessage, error)

NewVoteMessage creates a VOTE message

Types

type Consensus

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

Consensus is the Majority vOte Cellular Automata (MOCA) consensus layer

func NewConsensus

func NewConsensus(account *vault.Account, localNode *node.LocalNode) (*Consensus, error)

NewConsensus creates a MOCA consensus

func (*Consensus) GetAcceptedHeight

func (consensus *Consensus) GetAcceptedHeight() uint32

GetAcceptedHeight gets the latest block height that has been accepted by consensus

func (*Consensus) GetExpectedHeight

func (consensus *Consensus) GetExpectedHeight() uint32

GetExpectedHeight returns the expected consensus height

func (*Consensus) Start

func (consensus *Consensus) Start()

Start starts the consensus protocol

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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