MCPcopy Create free account
hub / github.com/ethstorage/es-node / initP2P

Method initP2P

ethstorage/node/node.go:222–234  ·  view source on GitHub ↗
(ctx context.Context, cfg *Config)

Source from the content-addressed store, hash-verified

220}
221
222func (n *EsNode) initP2P(ctx context.Context, cfg *Config) error {
223 if cfg.P2P != nil {
224 p2pNode, err := p2p.NewNodeP2P(n.resourcesCtx, cfg.ChainID, n.lg, cfg.P2P, n.storageManager, n.db, n.metrics, n.feed)
225 if err != nil || p2pNode == nil {
226 return err
227 }
228 n.p2pNode = p2pNode
229 if n.p2pNode.Dv5Udp() != nil {
230 go n.p2pNode.DiscoveryProcess(n.resourcesCtx, n.lg, cfg.ChainID.Uint64(), cfg.P2P.TargetPeers())
231 }
232 }
233 return nil
234}
235
236func (n *EsNode) initStorageManager(ctx context.Context, cfg *Config) error {
237 shardManager := ethstorage.NewShardManager(cfg.Storage.L1Contract, cfg.Storage.KvSize, cfg.Storage.KvEntriesPerShard, cfg.Storage.ChunkSize)

Callers 1

initMethod · 0.95

Calls 4

NewNodeP2PFunction · 0.92
Dv5UdpMethod · 0.80
DiscoveryProcessMethod · 0.80
TargetPeersMethod · 0.65

Tested by

no test coverage detected