diff options
author | Janos Guljas <janos@resenje.org> | 2018-09-25 22:57:31 +0800 |
---|---|---|
committer | Janos Guljas <janos@resenje.org> | 2018-09-25 22:57:31 +0800 |
commit | 24349144b6c0642755569268bab56b9033743212 (patch) | |
tree | 9d9d2b6659fd8a56512dfc807aafe4b733165ae1 /swarm/swarm.go | |
parent | 7d56602391e155e2ce9ba7c261300a1804ab9972 (diff) | |
parent | d3441ebb563439bac0837d70591f92e2c6080303 (diff) | |
download | go-tangerine-24349144b6c0642755569268bab56b9033743212.tar go-tangerine-24349144b6c0642755569268bab56b9033743212.tar.gz go-tangerine-24349144b6c0642755569268bab56b9033743212.tar.bz2 go-tangerine-24349144b6c0642755569268bab56b9033743212.tar.lz go-tangerine-24349144b6c0642755569268bab56b9033743212.tar.xz go-tangerine-24349144b6c0642755569268bab56b9033743212.tar.zst go-tangerine-24349144b6c0642755569268bab56b9033743212.zip |
Merge branch 'master' into max-stream-peer-servers
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 5db17d25f..0cd56d4eb 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, |