neatcon

package
v1.7.3-0...-f4d7a22 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BigStr1 = "362209239056230863865135"
	BigStr2 = "816822002239807650213698"
)
View Source
var (
	ErrUnauthorizedAddress = errors.New("unauthorized address")

	ErrStoppedEngine = errors.New("stopped engine")

	ErrStartedEngine = errors.New("started engine")

	ErrNoPrivValidator = errors.New("cannot start node without private validator")
)
View Source
var (
	DataDirFlag = cli.StringFlag{
		Name:  "datadir",
		Usage: "Data directory for the databases and keystore",
		Value: DefaultDataDir(),
	}

	VerbosityFlag = cli.IntFlag{
		Name:  "verbosity",
		Usage: "Verbosity of neatio",
	}

	MonikerFlag = cli.StringFlag{
		Name:  "moniker",
		Value: "",
		Usage: "Node's moniker",
	}

	NodeLaddrFlag = cli.StringFlag{
		Name:  "node_laddr",
		Value: "tcp://0.0.0.0:46656",
		Usage: "Node listen address. (0.0.0.0:0 means any interface, any port)",
	}

	SeedsFlag = cli.StringFlag{
		Name:  "seeds",
		Value: "",
		Usage: "Comma delimited host:port seed nodes",
	}

	FastSyncFlag = cli.BoolFlag{
		Name:  "fast_sync",
		Usage: "Fast blockchain syncing",
	}

	SkipUpnpFlag = cli.BoolFlag{
		Name:  "skip_upnp",
		Usage: "Skip UPNP configuration",
	}

	RpcLaddrFlag = cli.StringFlag{
		Name:  "rpc_laddr",
		Value: "unix://@neatiorpcunixsock",
		Usage: "RPC listen address. Port required",
	}
)
View Source
var DefaultConfig = &Config{
	RequestTimeout: 10000,
	BlockPeriod:    1,
	ProposerPolicy: RoundRobin,
	Epoch:          30000,
}

Functions

func ConcatCopyPreAllocate

func ConcatCopyPreAllocate(slices [][]byte) []byte

func DefaultDataDir

func DefaultDataDir() string

func GetBackend

func GetBackend() backend

func GetNeatConConfig

func GetNeatConConfig(chainId string, ctx *cli.Context) cfg.Config

func HomeDir

func HomeDir() string

func New

func New(chainConfig *params.ChainConfig, cliCtx *cli.Context,
	privateKey *ecdsa.PrivateKey, cch core.CrossChainHelper) consensus.NeatCon

func ProtocolAndAddress

func ProtocolAndAddress(listenAddr string) (string, string)

func SetEventSwitch

func SetEventSwitch(evsw types.EventSwitch, eventables ...types.Eventable)

Types

type API

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

func (*API) DecodeExtraData

func (api *API) DecodeExtraData(extra string) (extraApi *ntcTypes.NeatConExtraApi, err error)

func (*API) GetConsensusPublicKey

func (api *API) GetConsensusPublicKey(extra string) ([]string, error)

func (*API) GetCurrentEpochNumber

func (api *API) GetCurrentEpochNumber() (hexutil.Uint64, error)

func (*API) GetEpoch

func (api *API) GetEpoch(num hexutil.Uint64) (*ntcTypes.EpochApi, error)

func (*API) GetNextEpochValidators

func (api *API) GetNextEpochValidators() ([]*ntcTypes.EpochValidator, error)

func (*API) GetNextEpochVote

func (api *API) GetNextEpochVote() (*ntcTypes.EpochVotesApi, error)

func (*API) GetVoteHash

func (api *API) GetVoteHash(from common.Address, pubkey crypto.BLSPubKey, amount *hexutil.Big, salt string) common.Hash

type Config

type Config struct {
	RequestTimeout uint64         `toml:",omitempty"`
	BlockPeriod    uint64         `toml:",omitempty"`
	ProposerPolicy ProposerPolicy `toml:",omitempty"`
	Epoch          uint64         `toml:",omitempty"`
}

type Node

type Node struct {
	cmn.BaseService
	// contains filtered or unexported fields
}

func MakeNeatConNode

func MakeNeatConNode(backend *backend, config cfg.Config, chainConfig *params.ChainConfig, cch core.CrossChainHelper) *Node

func NewNodeNotStart

func NewNodeNotStart(backend *backend, config cfg.Config, chainConfig *params.ChainConfig, cch core.CrossChainHelper, genDoc *types.GenesisDoc) *Node

func (*Node) ConsensusReactor

func (n *Node) ConsensusReactor() *consensus.ConsensusReactor

func (*Node) ConsensusState

func (n *Node) ConsensusState() *consensus.ConsensusState

func (*Node) EventSwitch

func (n *Node) EventSwitch() types.EventSwitch

func (*Node) OnStart

func (n *Node) OnStart() error

func (*Node) OnStop

func (n *Node) OnStop()

func (*Node) PrivValidator

func (n *Node) PrivValidator() *types.PrivValidator

func (*Node) RunForever

func (n *Node) RunForever()

type ProposerPolicy

type ProposerPolicy uint64
const (
	RoundRobin ProposerPolicy = iota
	Sticky
)

Directories

Path Synopsis
config

Jump to

Keyboard shortcuts

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