node

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Number     uint32        `json:"number"`
	ID         types.Bytes32 `json:"id"`
	ParentID   types.Bytes32 `json:"parentID"`
	QC         *QC           `json:"qc"`
	Timestamp  uint64        `json:"timestamp"`
	TxCount    int           `json:"txCount"`
	LastKBlock uint32        `json:"lastKBlock"`
	Nonce      uint64        `json:"nonce"`
}

Block block

type BlockProbe

type BlockProbe struct {
	Height uint32 `json:"height"`
	Round  uint32 `json:"round"`
}

type ChainProbe

type ChainProbe struct {
	BestBlock *Block `json:"bestBlock"`
	BestQC    *QC    `json:"bestQC"`
}

type Network

type Network interface {
	PeersStats() []*comm.PeerStats
}

type Node

type Node struct {
	Cons  *consensus.Reactor
	Chain *chain.Chain
	// contains filtered or unexported fields
}

func New

func New(version string, chainId uint64, p2pSrv p2p.P2P, cons *consensus.Reactor, c *chain.Chain, pubkey []byte) *Node

func (*Node) Mount

func (n *Node) Mount(root *mux.Router, pathPrefix string)

type PacemakerProbe

type PacemakerProbe struct {
	CurRound uint32 `json:"curRound"`

	LastVotingHeight uint32 `json:"lastVotingHeight"`
	LastOnBeatRound  uint32 `json:"lastOnBeatRound"`
	ProposalCount    int    `json:"proposalCount"`

	QCHigh        *QC         `json:"qcHigh"`
	LastCommitted *BlockProbe `json:"lastCommitted"`
}

type Peer

type Peer struct {
	EnodeID    string `json:"enodeID"`
	Name       string `json:"name"`
	ID         string `json:"id"`
	RemoteAddr string `json:"remoteAddr"`
}

type PeerStats

type PeerStats struct {
	Name         string        `json:"name"`
	BestBlockID  types.Bytes32 `json:"bestBlockID"`
	BestBlockNum uint32        `json:"bestBlockNum"`
	PeerID       string        `json:"peerID"`
	NetAddr      string        `json:"netAddr"`
	Inbound      bool          `json:"inbound"`
	Duration     uint64        `json:"duration"`
}

func ConvertPeersStats

func ConvertPeersStats(ss []*comm.PeerStats) []*PeerStats

type ProbeResult

type ProbeResult struct {
	Name        string `json:"name"`
	PubKey      string `json:"pubkey"`
	PubKeyValid bool   `json:"pubkeyValid"`
	Version     string `json:"version"`

	InCommittee    bool   `json:"inCommittee"`
	CommitteeIndex uint32 `json:"committeeIndex"`
	CommitteeSize  uint32 `json:"committeeSize"`

	BestQC    uint32 `json:"bestQC"`
	BestBlock uint32 `json:"bestBlock"`

	Pacemaker *PacemakerProbe `json:"pacemaker"`
	Chain     *ChainProbe     `json:"chain"`
}

type QC

type QC struct {
	Epoch   uint64 `json:"epoch"`
	Round   uint32 `json:"round"`
	BlockID string `json:"blockID"`
}

Jump to

Keyboard shortcuts

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