Documentation ¶
Overview ¶
Package node does the initialization of all the required objects to either run as a synchronizer or as a coordinator.
The Node contains several goroutines that run in the background or that periodically perform tasks. One of this goroutines periodically calls the `Synchronizer.Sync` function, allowing the synchronization of one block at a time. After every call to `Synchronizer.Sync`, the Node sends a message to the Coordinator to notify it about the new synced block (and associated state) or reorg (and resetted state) in case one happens.
Other goroutines perform tasks such as: updating the token prices, update metrics stored in the historyDB, update recommended fee stored in the historyDB, run the http API server, run the debug http API server, etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIServer ¶
type APIServer struct {
// contains filtered or unexported fields
}
APIServer is a server that only runs the API
type Mode ¶
type Mode string
Mode sets the working mode of the node (synchronizer or coordinator)
const ( // ModeCoordinator defines the mode of the HermezNode as Coordinator, which // means that the node is set to forge (which also will be synchronizing with // the L1 blockchain state) ModeCoordinator Mode = "coordinator" // ModeSynchronizer defines the mode of the HermezNode as Synchronizer, which // means that the node is set to only synchronize with the L1 blockchain state // and will not forge ModeSynchronizer Mode = "synchronizer" )
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is the Hermez Node
func (*Node) StartSynchronizer ¶
func (n *Node) StartSynchronizer()
StartSynchronizer starts the synchronizer
type NodeAPI ¶
type NodeAPI struct {
// contains filtered or unexported fields
}
NodeAPI holds the node http API
func NewNodeAPI ¶
func NewNodeAPI( version, addr string, coordinatorEndpoints, explorerEndpoints bool, server *gin.Engine, hdb *historydb.HistoryDB, l2db *l2db.L2DB, ethClient *ethclient.Client, forgerAddress *ethCommon.Address, ) (*NodeAPI, error)
NewNodeAPI creates a new NodeAPI (which internally calls api.NewAPI)