diff --git a/app/submodule/network/network_submodule.go b/app/submodule/network/network_submodule.go index 5bf16d5b4f..f17c8f31c4 100644 --- a/app/submodule/network/network_submodule.go +++ b/app/submodule/network/network_submodule.go @@ -7,7 +7,6 @@ import ( "os" "path/filepath" "runtime" - "strings" "time" "github.com/ipfs/go-bitswap" @@ -27,10 +26,8 @@ import ( "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p-core/host" p2pmetrics "github.com/libp2p/go-libp2p-core/metrics" - smux "github.com/libp2p/go-libp2p-core/mux" "github.com/libp2p/go-libp2p-core/routing" dht "github.com/libp2p/go-libp2p-kad-dht" - mplex "github.com/libp2p/go-libp2p-mplex" libp2pps "github.com/libp2p/go-libp2p-pubsub" yamux "github.com/libp2p/go-libp2p-yamux" ma "github.com/multiformats/go-multiaddr" @@ -112,7 +109,7 @@ type networkConfig interface { // NewNetworkSubmodule creates a new network submodule. func NewNetworkSubmodule(ctx context.Context, config networkConfig) (*NetworkSubmodule, error) { bandwidthTracker := p2pmetrics.NewBandwidthCounter() - libP2pOpts := append(config.Libp2pOpts(), libp2p.BandwidthReporter(bandwidthTracker), makeSmuxTransportOption(true)) + libP2pOpts := append(config.Libp2pOpts(), libp2p.BandwidthReporter(bandwidthTracker), makeSmuxTransportOption()) var networkName string var err error @@ -400,9 +397,8 @@ func buildHost(ctx context.Context, config networkConfig, libP2pOpts []libp2p.Op return libp2p.New(opts...) } -func makeSmuxTransportOption(mplexExp bool) libp2p.Option { +func makeSmuxTransportOption() libp2p.Option { const yamuxID = "/yamux/1.0.0" - const mplexID = "/mplex/6.7.0" ymxtpt := *yamux.DefaultTransport ymxtpt.AcceptBacklog = 512 @@ -411,27 +407,5 @@ func makeSmuxTransportOption(mplexExp bool) libp2p.Option { ymxtpt.LogOutput = os.Stderr } - muxers := map[string]smux.Multiplexer{yamuxID: &ymxtpt} - if mplexExp { - muxers[mplexID] = mplex.DefaultTransport - } - - // Allow muxer preference order overriding - order := []string{yamuxID, mplexID} - if prefs := os.Getenv("LIBP2P_MUX_PREFS"); prefs != "" { - order = strings.Fields(prefs) - } - - opts := make([]libp2p.Option, 0, len(order)) - for _, id := range order { - tpt, ok := muxers[id] - if !ok { - networkLogger.Warnf("unknown or duplicate muxer in LIBP2P_MUX_PREFS: %s", id) - continue - } - delete(muxers, id) - opts = append(opts, libp2p.Muxer(id, tpt)) - } - - return libp2p.ChainOptions(opts...) + return libp2p.Muxer(yamuxID, &ymxtpt) } diff --git a/go.mod b/go.mod index 2f3c596ca6..ac8d08121e 100644 --- a/go.mod +++ b/go.mod @@ -92,7 +92,6 @@ require ( github.com/libp2p/go-libp2p v0.17.0 github.com/libp2p/go-libp2p-core v0.13.0 github.com/libp2p/go-libp2p-kad-dht v0.15.0 - github.com/libp2p/go-libp2p-mplex v0.4.1 github.com/libp2p/go-libp2p-peerstore v0.6.0 github.com/libp2p/go-libp2p-pubsub v0.6.0 github.com/libp2p/go-libp2p-swarm v0.9.0 diff --git a/pkg/messagepool/selection_test.go b/pkg/messagepool/selection_test.go index 59145f6192..dccda26322 100644 --- a/pkg/messagepool/selection_test.go +++ b/pkg/messagepool/selection_test.go @@ -5,8 +5,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/stretchr/testify/require" - cbg "github.com/whyrusleeping/cbor-gen" "io" "math" "math/big" @@ -15,6 +13,9 @@ import ( "sort" "testing" + "github.com/stretchr/testify/require" + cbg "github.com/whyrusleeping/cbor-gen" + "github.com/filecoin-project/go-address" tbig "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/crypto"