Skip to content

Commit

Permalink
remove the blankValidator from the DHT initialization (#4430)
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode authored Jun 1, 2021
1 parent 79c3a10 commit b3a571d
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions app/submodule/network/network_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ import (
"bytes"
"context"
"fmt"
"github.com/filecoin-project/venus/app/submodule/apiface"
"github.com/filecoin-project/venus/pkg/repo"
"github.com/filecoin-project/venus/pkg/types"
"github.com/filecoin-project/venus/pkg/util/blockstoreutil"
blocks "github.com/ipfs/go-block-format"
bserv "github.com/ipfs/go-blockservice"
"os"
"path/filepath"
"runtime"
Expand All @@ -19,7 +13,13 @@ import (
datatransfer "github.com/filecoin-project/go-data-transfer"
dtnet "github.com/filecoin-project/go-data-transfer/network"
dtgstransport "github.com/filecoin-project/go-data-transfer/transport/graphsync"
"github.com/filecoin-project/venus/app/submodule/apiface"
"github.com/filecoin-project/venus/app/submodule/blockstore"
"github.com/filecoin-project/venus/pkg/repo"
"github.com/filecoin-project/venus/pkg/types"
"github.com/filecoin-project/venus/pkg/util/blockstoreutil"
blocks "github.com/ipfs/go-block-format"
bserv "github.com/ipfs/go-blockservice"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace"
logging "github.com/ipfs/go-log"
Expand Down Expand Up @@ -89,11 +89,6 @@ func (networkSubmodule *NetworkSubmodule) Stop(ctx context.Context) {
}
}

type blankValidator struct{}

func (blankValidator) Validate(_ string, _ []byte) error { return nil }
func (blankValidator) Select(_ string, _ [][]byte) (int, error) { return 0, nil }

type networkConfig interface {
GenesisCid() cid.Cid
OfflineMode() bool
Expand Down Expand Up @@ -126,15 +121,13 @@ func NewNetworkSubmodule(ctx context.Context, config networkConfig, repo network
// set up host
var peerHost host.Host
var router routing.Routing
validator := blankValidator{}
var pubsubMessageSigning bool
var peerMgr net.IPeerMgr
// if !config.OfflineMode() {
makeDHT := func(h host.Host) (routing.Routing, error) {
mode := dht.ModeAuto
opts := []dht.Option{dht.Mode(mode),
dht.Datastore(repo.ChainDatastore()),
dht.NamespacedValidator("v", validator),
dht.ProtocolPrefix(net.FilecoinDHT(networkName)),
dht.QueryFilter(dht.PublicQueryFilter),
dht.RoutingTableFilter(dht.PublicRoutingTableFilter),
Expand Down

0 comments on commit b3a571d

Please sign in to comment.