diff options
Diffstat (limited to 'swarm/swarm.go')
-rw-r--r-- | swarm/swarm.go | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/swarm/swarm.go b/swarm/swarm.go index 13aa1125d..8b2661529 100644 --- a/swarm/swarm.go +++ b/swarm/swarm.go @@ -36,7 +36,7 @@ import ( "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/protocols" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" @@ -125,21 +125,11 @@ func NewSwarm(config *api.Config, mockStore *mock.NodeStore) (self *Swarm, err e config.HiveParams.Discovery = true - nodeID, err := discover.HexID(config.NodeID) - if err != nil { - return nil, err - } - addr := &network.BzzAddr{ - OAddr: common.FromHex(config.BzzKey), - UAddr: []byte(discover.NewNode(nodeID, net.IP{127, 0, 0, 1}, 30303, 30303).String()), - } - bzzconfig := &network.BzzConfig{ - NetworkID: config.NetworkID, - OverlayAddr: addr.OAddr, - UnderlayAddr: addr.UAddr, - HiveParams: config.HiveParams, - LightNode: config.LightNodeEnabled, + NetworkID: config.NetworkID, + OverlayAddr: common.FromHex(config.BzzKey), + HiveParams: config.HiveParams, + LightNode: config.LightNodeEnabled, } stateStore, err := state.NewDBStore(filepath.Join(config.Path, "state-store.db")) @@ -181,8 +171,12 @@ func NewSwarm(config *api.Config, mockStore *mock.NodeStore) (self *Swarm, err e delivery := stream.NewDelivery(to, self.netStore) self.netStore.NewNetFetcherFunc = network.NewFetcherFactory(delivery.RequestFromPeers, config.DeliverySkipCheck).New - self.streamer = stream.NewRegistry(addr, delivery, self.netStore, stateStore, &stream.RegistryOptions{ - SkipCheck: config.SyncingSkipCheck, + var nodeID enode.ID + if err := nodeID.UnmarshalText([]byte(config.NodeID)); err != nil { + return nil, err + } + self.streamer = stream.NewRegistry(nodeID, delivery, self.netStore, stateStore, &stream.RegistryOptions{ + SkipCheck: config.DeliverySkipCheck, DoSync: config.SyncEnabled, DoRetrieve: true, SyncUpdateDelay: config.SyncUpdateDelay, |