From 5f5f99d0b4d12561129b6b83bc869bcac85acd58 Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Thu, 19 Nov 2020 18:30:11 -0500 Subject: Remove unnecessary p2p server from node --- node/node.go | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/node/node.go b/node/node.go index 3ed89ed..e0a6424 100644 --- a/node/node.go +++ b/node/node.go @@ -113,8 +113,8 @@ func New(conf *Config) (*Node, error) { eventmux: new(event.TypeMux), log: conf.Logger, stop: make(chan struct{}), - server: &p2p.Server{Config: conf.P2P}, - databases: make(map[*closeTrackingDB]struct{}), + // server: &p2p.Server{Config: conf.P2P}, + databases: make(map[*closeTrackingDB]struct{}), } // Register built-in APIs. @@ -133,19 +133,19 @@ func New(conf *Config) (*Node, error) { node.accman = am node.ephemKeystore = ephemeralKeystore - // Initialize the p2p server. This creates the node key and discovery databases. - node.server.Config.PrivateKey = node.config.NodeKey() - node.server.Config.Name = node.config.NodeName() - node.server.Config.Logger = node.log - if node.server.Config.StaticNodes == nil { - node.server.Config.StaticNodes = node.config.StaticNodes() - } - if node.server.Config.TrustedNodes == nil { - node.server.Config.TrustedNodes = node.config.TrustedNodes() - } - if node.server.Config.NodeDatabase == "" { - node.server.Config.NodeDatabase = node.config.NodeDB() - } + // // Initialize the p2p server. This creates the node key and discovery databases. + // node.server.Config.PrivateKey = node.config.NodeKey() + // node.server.Config.Name = node.config.NodeName() + // node.server.Config.Logger = node.log + // if node.server.Config.StaticNodes == nil { + // node.server.Config.StaticNodes = node.config.StaticNodes() + // } + // if node.server.Config.TrustedNodes == nil { + // node.server.Config.TrustedNodes = node.config.TrustedNodes() + // } + // if node.server.Config.NodeDatabase == "" { + // node.server.Config.NodeDatabase = node.config.NodeDB() + // } // Configure RPC servers. @@ -161,10 +161,11 @@ func (n *Node) Config() *Config { // only to inspect fields of the currently running server. Callers should not // start or stop the returned server. func (n *Node) Server() *p2p.Server { - n.lock.Lock() - defer n.lock.Unlock() + // n.lock.Lock() + // defer n.lock.Unlock() - return n.server + // return n.server + return nil } // DataDir retrieves the current datadir used by the protocol stack. -- cgit v1.2.3-70-g09d2