node

package
v0.0.0-...-fb4f826 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodekeyFile = "nodekey"
	GenesisFile = "genesis.json"
	PeersFile   = "peers.json"
)
View Source
const MaxProcsNum = 8 // set corresponding num of CPUs when benchmark test
View Source
const MinGraceHeight = 4

Variables

View Source
var DefaultConfig = Config{
	PointPort:       15150,
	TopicPort:       16160,
	APIPort:         9090,
	BroadcastTx:     true,
	StorageConfig:   storage.DefaultConfig,
	ExecutionConfig: execution.DefaultConfig,
	ConsensusConfig: consensus.DefaultConfig,
}

Functions

func MajorityCount

func MajorityCount(validatorCount int) int

MajorityCount returns 2f + 1 members

func NewRoleStore

func NewRoleStore(genesis *Genesis, peers []*Peer) *roleStore

func ReadNodeKey

func ReadNodeKey(datadir string) (*core.PrivateKey, error)

func Run

func Run(config Config)

func StringToPubKey

func StringToPubKey(v string) *core.PublicKey

func WriteGenesisFile

func WriteGenesisFile(datadir string, genesis *Genesis) error

func WriteNodeKey

func WriteNodeKey(datadir string, key *core.PrivateKey) error

func WritePeersFile

func WritePeersFile(datadir string, peers []*Peer) error

Types

type Config

type Config struct {
	Debug       bool
	DataDir     string
	PointPort   int
	TopicPort   int
	APIPort     int
	BroadcastTx bool

	StorageConfig   storage.Config
	ExecutionConfig execution.Config
	ConsensusConfig consensus.Config
}

type Genesis

type Genesis struct {
	Validators  []string
	StakeQuotas []uint64
	WindowSize  int
}

func ReadGenesis

func ReadGenesis(datadir string) (*Genesis, error)

type Node

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

func (*Node) GetBlock

func (node *Node) GetBlock(hash []byte) (*core.Block, error)

func (*Node) GetQC

func (node *Node) GetQC(hash []byte) (*core.QuorumCert, error)

func (*Node) GetTxList

func (node *Node) GetTxList(hashes [][]byte) (*core.TxList, error)

type Peer

type Peer struct {
	PubKey    []byte
	PointAddr string
	TopicAddr string
}

func ReadPeers

func ReadPeers(datadir string) ([]*Peer, error)

Jump to

Keyboard shortcuts

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