neatcon

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnauthorizedAddress is returned when given address cannot be found in
	// current validator set.
	ErrUnauthorizedAddress = errors.New("unauthorized address")
	// ErrStoppedEngine is returned if the engine is stopped
	ErrStoppedEngine = errors.New("stopped engine")
	// ErrStartedEngine is returned if the engine is already started
	ErrStartedEngine = errors.New("started engine")

	// ErrNoPrivValidator is returned if private validator is not set during the start of the node
	ErrNoPrivValidator = errors.New("cannot start node without private validator")
)
View Source
var (

	// So we can control the DefaultDir
	DataDirFlag = cli.StringFlag{
		Name:  "datadir",
		Usage: "Data directory for the databases and keystore",
		Value: DefaultDataDir(),
	}

	// Not exposed by neatchain
	VerbosityFlag = cli.IntFlag{
		Name:  "verbosity",
		Usage: "Verbosity of neatchain",
	}

	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://@neatchainrpcunixsock",
		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

New creates an Ethereum backend for NeatCon core engine.

func ProtocolAndAddress

func ProtocolAndAddress(listenAddr string) (string, string)

Defaults to tcp

func SetEventSwitch

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

Add the event switch to reactors, mempool, etc.

Types

type API

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

API is a user facing RPC API of NeatCon

func (*API) CreateValidator

func (api *API) CreateValidator(from common.Address) (*ntcTypes.PrivV, error)

CreateValidator

func (*API) DecodeExtraData

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

decode extra data

func (*API) GetCandidateList

func (api *API) GetCandidateList() (*ntcTypes.CandidateApi, error)

func (*API) GetConsensusPublicKey

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

get consensus publickey of the block

func (*API) GetCurrentEpochNumber

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

GetCurrentEpochNumber retrieves the current epoch number.

func (*API) GetEpoch

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

GetEpoch retrieves the Epoch Detail by Number

func (*API) GetForbiddenList

func (api *API) GetForbiddenList() (*ntcTypes.ForbiddenApi, error)

func (*API) GetNextEpochValidators

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

func (*API) GetNextEpochVote

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

GetEpochVote

func (*API) GetValidatorStatus

func (api *API) GetValidatorStatus(from common.Address) (*ntcTypes.ValidatorStatus, 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"` // The timeout for each Istanbul round in milliseconds.
	BlockPeriod    uint64         `toml:",omitempty"` // Default minimum difference between two consecutive block's timestamps in second
	ProposerPolicy ProposerPolicy `toml:",omitempty"` // The policy for proposer selection
	Epoch          uint64         `toml:",omitempty"` // The number of blocks after which to checkpoint and reset the pending votes
}

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

XXX: for convenience

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