node

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: MPL-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNodeMakeFailureFormat              = "error creating p2p node: %s"
	ErrWhisperServiceRegistrationFailure  = errors.New("failed to register the Whisper service")
	ErrLightEthRegistrationFailure        = errors.New("failed to register the LES service")
	ErrPersonalServiceRegistrationFailure = errors.New("failed to register the personal api service")
	ErrStatusServiceRegistrationFailure   = errors.New("failed to register the Status service")
	ErrPeerServiceRegistrationFailure     = errors.New("failed to register the Peer service")
)

Errors related to node and services creation.

View Source
var (
	ErrNodeRunning            = errors.New("node is already running")
	ErrNoGethNode             = errors.New("geth node is not available")
	ErrNoRunningNode          = errors.New("there is no running node")
	ErrAccountKeyStoreMissing = errors.New("account key store is not set")
	ErrServiceUnknown         = errors.New("service unknown")
)

errors

Functions

func MakeNode

func MakeNode(config *params.NodeConfig, db *leveldb.DB) (*node.Node, error)

MakeNode create a geth node entity

Types

type StatusNode

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

StatusNode abstracts contained geth node and provides helper methods to interact with it.

func New

func New() *StatusNode

New makes new instance of StatusNode.

func (*StatusNode) AccountKeyStore

func (n *StatusNode) AccountKeyStore() (*keystore.KeyStore, error)

AccountKeyStore exposes reference to accounts key store

func (*StatusNode) AccountManager

func (n *StatusNode) AccountManager() (*accounts.Manager, error)

AccountManager exposes reference to node's accounts manager

func (*StatusNode) AddPeer

func (n *StatusNode) AddPeer(url string) error

AddPeer adds new static peer node

func (*StatusNode) Config

func (n *StatusNode) Config() *params.NodeConfig

Config exposes reference to running node's configuration

func (*StatusNode) Discover

func (n *StatusNode) Discover(topic string, max, min int) (err error)

Discover sets up the discovery for a specific topic.

func (*StatusNode) EnsureSync

func (n *StatusNode) EnsureSync(ctx context.Context) error

EnsureSync waits until blockchain synchronization is complete and returns.

func (*StatusNode) GethNode

func (n *StatusNode) GethNode() *node.Node

GethNode returns underlying geth node.

func (*StatusNode) IsRunning

func (n *StatusNode) IsRunning() bool

IsRunning confirm that node is running.

func (*StatusNode) LightEthereumService

func (n *StatusNode) LightEthereumService() (l *les.LightEthereum, err error)

LightEthereumService exposes reference to LES service running on top of the node

func (*StatusNode) PeerCount

func (n *StatusNode) PeerCount() int

PeerCount returns the number of connected peers.

func (*StatusNode) PeerService

func (n *StatusNode) PeerService() (st *peer.Service, err error)

PeerService exposes reference to peer service running on top of the node.

func (*StatusNode) RPCClient

func (n *StatusNode) RPCClient() *rpc.Client

RPCClient exposes reference to RPC client connected to the running node.

func (*StatusNode) RPCPrivateClient

func (n *StatusNode) RPCPrivateClient() *rpc.Client

RPCPrivateClient exposes reference to RPC client connected to the running node that can call both public and private APIs.

func (*StatusNode) ReconnectStaticPeers

func (n *StatusNode) ReconnectStaticPeers() error

ReconnectStaticPeers removes and adds static peers to a server.

func (*StatusNode) ResetChainData

func (n *StatusNode) ResetChainData(config *params.NodeConfig) error

ResetChainData removes chain data if node is not running.

func (*StatusNode) Server

func (n *StatusNode) Server() *p2p.Server

Server retrieves the currently running P2P network layer.

func (*StatusNode) ShhExtService added in v0.10.2

func (n *StatusNode) ShhExtService() (s *shhext.Service, err error)

ShhExtService exposes reference to shh extension service running on top of the node

func (*StatusNode) Start

func (n *StatusNode) Start(config *params.NodeConfig, services ...node.ServiceConstructor) error

Start starts current StatusNode, will fail if it's already started.

func (*StatusNode) StatusService

func (n *StatusNode) StatusService() (st *status.Service, err error)

StatusService exposes reference to status service running on top of the node

func (*StatusNode) Stop

func (n *StatusNode) Stop() error

Stop will stop current StatusNode. A stopped node cannot be resumed.

func (*StatusNode) WhisperService

func (n *StatusNode) WhisperService() (w *whisper.Whisper, err error)

WhisperService exposes reference to Whisper service running on top of the node

Jump to

Keyboard shortcuts

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