node

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructBlocksSyncMessage

func ConstructBlocksSyncMessage(blocks []*types.Block) []byte

ConstructBlocksSyncMessage constructs blocks sync message to send blocks to other nodes

func ConstructCXReceiptsProof

func ConstructCXReceiptsProof(cxReceiptsProof *types.CXReceiptsProof) []byte

ConstructCXReceiptsProof constructs cross shard receipts and related proof including merkle proof, blockHeader and commitSignatures

func ConstructCrossLinkMessage added in v1.3.0

func ConstructCrossLinkMessage(bc engine.ChainReader, headers []*block.Header) []byte

ConstructCrossLinkMessage constructs cross link message to send to beacon chain

func ConstructSlashMessage added in v1.3.1

func ConstructSlashMessage(witnesses slash.Records) []byte

ConstructSlashMessage ..

func ConstructStakingTransactionListMessageAccount added in v1.3.0

func ConstructStakingTransactionListMessageAccount(
	transactions staking.StakingTransactions,
) []byte

ConstructStakingTransactionListMessageAccount constructs serialized staking transactions in account model

func ConstructTransactionListMessageAccount

func ConstructTransactionListMessageAccount(transactions types.Transactions) []byte

ConstructTransactionListMessageAccount constructs serialized transactions in account model

func SerializeBlockchainSyncMessage

func SerializeBlockchainSyncMessage(blockchainSyncMessage *BlockchainSyncMessage) []byte

SerializeBlockchainSyncMessage serializes BlockchainSyncMessage.

Types

type BlockMessageType

type BlockMessageType int

BlockMessageType represents the type of messages used for Node/Block

const (
	Sync BlockMessageType = iota

	CrossLink      // used for crosslink from beacon chain to shard chain
	Receipt        // cross-shard transaction receipts
	SlashCandidate // A report of a double-signing event
)

Block sync message subtype

type BlockchainSyncMessage

type BlockchainSyncMessage struct {
	BlockHeight int
	BlockHashes []common.Hash
}

BlockchainSyncMessage is a struct for blockchain sync message.

func DeserializeBlockchainSyncMessage

func DeserializeBlockchainSyncMessage(d []byte) (*BlockchainSyncMessage, error)

DeserializeBlockchainSyncMessage deserializes BlockchainSyncMessage.

type BlockchainSyncMessageType

type BlockchainSyncMessageType int

BlockchainSyncMessageType represents BlockchainSyncMessageType type.

const (
	Done BlockchainSyncMessageType = iota
	GetLastBlockHashes
	GetBlock
)

Constant of blockchain sync-up message subtype

type Info

type Info struct {
	IP     string
	Port   string
	PubKey []byte
	Role   RoleType
	PeerID peer.ID // Peerstore ID
}

Info refers to Peer struct in p2p/peer.go this is basically a simplified version of Peer for network transportation

func (Info) String

func (info Info) String() string

type MessageType

type MessageType byte

MessageType is to indicate the specific type of message under Node category

const (
	Transaction MessageType = iota
	Block
	Client

	PING       // node send ip/pki to register with leader
	ShardState // Deprecated
	Staking
)

Constant of the top level Message Type exchanged among nodes

type RoleType

type RoleType int

RoleType defines the role of the node

const (
	ValidatorRole RoleType = iota
	ClientRole
)

Type of roles of a node

func (RoleType) String

func (r RoleType) String() string

type TransactionMessageType

type TransactionMessageType int

TransactionMessageType representa the types of messages used for Node/Transaction

const (
	Send TransactionMessageType = iota
	Unlock
)

Constant of transaction message subtype

Jump to

Keyboard shortcuts

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