consensus

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 25 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(ledgerBlockHash common.Uint256, ledgerHeight, consensusHeight, minVerifiableHeight 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, requestType pb.RequestTransactionType, shortHashSalt []byte, shortHashSize uint32) (*pb.UnsignedMessage, error)

NewRequestBlockProposalMessage creates a REQUEST_BLOCK_PROPOSAL message to request a block

func NewRequestBlockProposalReply

func NewRequestBlockProposalReply(b *block.Block, txnsHash [][]byte) (*pb.UnsignedMessage, error)

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

func NewRequestProposalTransactionsMessage

func NewRequestProposalTransactionsMessage(blockHash common.Uint256, requestType pb.RequestTransactionType, shortHashSalt []byte, shortHashSize uint32, transactionsHash [][]byte) (*pb.UnsignedMessage, error)

NewRequestProposalTransactionsMessage creates a REQUEST_PROPOSAL_TRANSACTIONS message to request a block

func NewRequestProposalTransactionsReply

func NewRequestProposalTransactionsReply(transactions []*transaction.Transaction) (*pb.UnsignedMessage, error)

NewRequestProposalTransactionsReply creates a REQUEST_PROPOSAL_TRANSACTIONS_REPLY message in respond to REQUEST_PROPOSAL_TRANSACTIONS 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