From f24509594ef0e86d80c4ad21a64ac6cf9289926b Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Tue, 12 Feb 2019 23:36:52 -0800 Subject: [PATCH] Remove libp2p config option passthrough No code uses this libp2p-specific hardwiring provision. --- p2p/host/hostv2/hostv2.go | 5 ++--- p2p/p2pimpl/p2pimpl.go | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/p2p/host/hostv2/hostv2.go b/p2p/host/hostv2/hostv2.go index 87caa2cec..80f45d8f2 100644 --- a/p2p/host/hostv2/hostv2.go +++ b/p2p/host/hostv2/hostv2.go @@ -18,7 +18,6 @@ import ( peerstore "github.com/libp2p/go-libp2p-peerstore" protocol "github.com/libp2p/go-libp2p-protocol" pubsub "github.com/libp2p/go-libp2p-pubsub" - p2p_config "github.com/libp2p/go-libp2p/config" ma "github.com/multiformats/go-multiaddr" ) @@ -150,7 +149,7 @@ func (host *HostV2) Peerstore() peerstore.Peerstore { } // New creates a host for p2p communication -func New(self *p2p.Peer, priKey p2p_crypto.PrivKey, opts ...p2p_config.Option) *HostV2 { +func New(self *p2p.Peer, priKey p2p_crypto.PrivKey) *HostV2 { listenAddr, err := ma.NewMultiaddr(fmt.Sprintf("/ip4/0.0.0.0/tcp/%s", self.Port)) if err != nil { log.Error("New MA Error", "IP", self.IP, "Port", self.Port) @@ -159,7 +158,7 @@ func New(self *p2p.Peer, priKey p2p_crypto.PrivKey, opts ...p2p_config.Option) * // TODO – use WithCancel for orderly host teardown (which we don't have yet) ctx := context.Background() p2pHost, err := libp2p.New(ctx, - append(opts, libp2p.ListenAddrs(listenAddr), libp2p.Identity(priKey))..., + libp2p.ListenAddrs(listenAddr), libp2p.Identity(priKey), ) catchError(err) pubsub, err := pubsub.NewGossipSub(ctx, p2pHost) diff --git a/p2p/p2pimpl/p2pimpl.go b/p2p/p2pimpl/p2pimpl.go index c78de3a6f..d00138a97 100644 --- a/p2p/p2pimpl/p2pimpl.go +++ b/p2p/p2pimpl/p2pimpl.go @@ -8,14 +8,13 @@ import ( "github.com/harmony-one/harmony/internal/utils" p2p_crypto "github.com/libp2p/go-libp2p-crypto" - p2p_config "github.com/libp2p/go-libp2p/config" ) // NewHost starts the host for p2p // for hostv2, it generates multiaddress, keypair and add PeerID to peer, add priKey to host // TODO (leo) The peerstore has to be persisted on disk. -func NewHost(self *p2p.Peer, key p2p_crypto.PrivKey, opts ...p2p_config.Option) (p2p.Host, error) { - h := hostv2.New(self, key, opts...) +func NewHost(self *p2p.Peer, key p2p_crypto.PrivKey) (p2p.Host, error) { + h := hostv2.New(self, key) utils.GetLogInstance().Info("NewHost", "self", net.JoinHostPort(self.IP, self.Port), "PeerID", self.PeerID)