Documentation ¶
Overview ¶
Package node is the main entry point, where the Node struct, which represents a full node, is defined.
Adding new p2p.Reactor(s)
To add a new p2p.Reactor, use the CustomReactors option:
node, err := NewNode( config, privVal, nodeKey, clientCreator, genesisDocProvider, dbProvider, logger, CustomReactors(map[string]p2p.Reactor{"CUSTOM": customReactor}), )
Replacing existing p2p.Reactor(s)
To replace the built-in p2p.Reactor, use the CustomReactors option:
node, err := NewNode( config, privVal, nodeKey, clientCreator, genesisDocProvider, dbProvider, logger, CustomReactors(map[string]p2p.Reactor{"BLOCKCHAIN": customBlockchainReactor}), )
The list of existing reactors can be found in CustomReactors documentation.
Index ¶
- func DefaultDBProvider(ctx *DBContext) (dbm.DB, error)
- func LoadStateFromDBOrGenesisDocProvider(stateDB dbm.DB, genesisDocProvider GenesisDocProvider) (sm.State, *types.GenesisDoc, error)
- type DBContext
- type DBProvider
- type GenesisDocProvider
- type Node
- func (n *Node) BlockStore() *store.BlockStore
- func (n *Node) Config() *cfg.Config
- func (n *Node) ConsensusReactor() *cs.ConsensusReactor
- func (n *Node) ConsensusState() *cs.ConsensusState
- func (n *Node) EventSwitch() events.EventSwitch
- func (n *Node) GenesisDoc() *types.GenesisDoc
- func (n *Node) IsListening() bool
- func (n *Node) Listeners() []string
- func (n *Node) Mempool() mempl.Mempool
- func (n *Node) MempoolReactor() *mempl.Reactor
- func (n *Node) NodeInfo() p2p.NodeInfo
- func (n *Node) OnStart() error
- func (n *Node) OnStop()
- func (n *Node) PrivValidator() types.PrivValidator
- func (n *Node) ProxyApp() appconn.AppConns
- func (n *Node) Ready() <-chan struct{}
- func (n *Node) Switch() *p2p.Switch
- type NodeGreeting
- type NodeID
- type NodeProvider
- type Option
- type PrivNodeID
- type SignedNodeGreeting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDBProvider ¶
DefaultDBProvider returns a database using the db.Backend and DBDir specified in the ctx.Config.
func LoadStateFromDBOrGenesisDocProvider ¶
func LoadStateFromDBOrGenesisDocProvider(stateDB dbm.DB, genesisDocProvider GenesisDocProvider) (sm.State, *types.GenesisDoc, error)
LoadStateFromDBOrGenesisDocProvider attempts to load the state from the database, or creates one using the given genesisDocProvider and persists the result to the database. On success this also returns the genesis doc loaded through the given provider.
Types ¶
type DBProvider ¶
DBProvider takes a DBContext and returns an instantiated DB.
type GenesisDocProvider ¶
type GenesisDocProvider func() (*types.GenesisDoc, error)
GenesisDocProvider returns a GenesisDoc. It allows the GenesisDoc to be pulled from sources other than the filesystem, for instance from a distributed key-value store cluster.
func DefaultGenesisDocProviderFunc ¶
func DefaultGenesisDocProviderFunc(genesisFile string) GenesisDocProvider
DefaultGenesisDocProviderFunc returns a GenesisDocProvider that loads the GenesisDoc from the genesis path on the filesystem.
type Node ¶
type Node struct { service.BaseService // contains filtered or unexported fields }
Node is the highest level interface to a full Tendermint node. It includes all configuration information and running services.
func DefaultNewNode ¶
func DefaultNewNode( config *cfg.Config, genesisFile string, evsw events.EventSwitch, logger *slog.Logger, ) (*Node, error)
DefaultNewNode returns a Tendermint node with default settings for the PrivValidator, ClientCreator, GenesisDoc, and DBProvider. It implements NodeProvider.
func NewNode ¶
func NewNode(config *cfg.Config, privValidator types.PrivValidator, nodeKey *p2p.NodeKey, clientCreator appconn.ClientCreator, genesisDocProvider GenesisDocProvider, dbProvider DBProvider, evsw events.EventSwitch, logger *slog.Logger, options ...Option, ) (*Node, error)
NewNode returns a new, ready to go, Tendermint Node.
func (*Node) BlockStore ¶
func (n *Node) BlockStore() *store.BlockStore
BlockStore returns the Node's BlockStore.
func (*Node) ConsensusReactor ¶
func (n *Node) ConsensusReactor() *cs.ConsensusReactor
ConsensusReactor returns the Node's ConsensusReactor.
func (*Node) ConsensusState ¶
func (n *Node) ConsensusState() *cs.ConsensusState
ConsensusState returns the Node's ConsensusState.
func (*Node) EventSwitch ¶
func (n *Node) EventSwitch() events.EventSwitch
EventSwitch returns the node's EventSwitch.
func (*Node) GenesisDoc ¶
func (n *Node) GenesisDoc() *types.GenesisDoc
GenesisDoc returns the Node's GenesisDoc.
func (*Node) IsListening ¶
func (*Node) MempoolReactor ¶
MempoolReactor returns the Node's mempool reactor.
func (*Node) PrivValidator ¶
func (n *Node) PrivValidator() types.PrivValidator
PrivValidator returns the Node's PrivValidator. XXX: for convenience only!
func (*Node) ProxyApp ¶
ProxyApp returns the Node's AppConns, representing its connections to the ABCI application.
type NodeGreeting ¶
type NodeProvider ¶
NodeProvider takes a config and a logger and returns a ready to go Node.
type Option ¶
type Option func(*Node)
Option sets a parameter for the node.
func CustomReactors ¶
CustomReactors allows you to add custom reactors (name -> p2p.Reactor) to the node's Switch.
WARNING: using any name from the below list of the existing reactors will result in replacing it with the custom one.
- MEMPOOL
- BLOCKCHAIN
- CONSENSUS
- EVIDENCE
- PEX
type PrivNodeID ¶
func (*PrivNodeID) SignGreeting ¶
func (pnid *PrivNodeID) SignGreeting() *SignedNodeGreeting
type SignedNodeGreeting ¶
type SignedNodeGreeting struct { NodeGreeting Signature []byte }