diff options
Diffstat (limited to 'swarm/pss/client')
-rw-r--r-- | swarm/pss/client/client.go | 8 | ||||
-rw-r--r-- | swarm/pss/client/client_test.go | 11 |
2 files changed, 8 insertions, 11 deletions
diff --git a/swarm/pss/client/client.go b/swarm/pss/client/client.go index 532a22384..d541081d3 100644 --- a/swarm/pss/client/client.go +++ b/swarm/pss/client/client.go @@ -27,7 +27,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "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/rlp" "github.com/ethereum/go-ethereum/rpc" @@ -283,8 +283,7 @@ func (c *Client) RunProtocol(ctx context.Context, proto *p2p.Protocol) error { break } c.peerPool[topicobj][pubkeyid] = rw - nid, _ := discover.HexID("0x00") - p := p2p.NewPeer(nid, fmt.Sprintf("%v", addr), []p2p.Cap{}) + p := p2p.NewPeer(enode.ID{}, fmt.Sprintf("%v", addr), []p2p.Cap{}) go proto.Run(p, c.peerPool[topicobj][pubkeyid]) } go func() { @@ -334,8 +333,7 @@ func (c *Client) AddPssPeer(pubkeyid string, addr []byte, spec *protocols.Spec) c.poolMu.Lock() c.peerPool[topic][pubkeyid] = rw c.poolMu.Unlock() - nid, _ := discover.HexID("0x00") - p := p2p.NewPeer(nid, fmt.Sprintf("%v", addr), []p2p.Cap{}) + p := p2p.NewPeer(enode.ID{}, fmt.Sprintf("%v", addr), []p2p.Cap{}) go c.protos[topic].Run(p, c.peerPool[topic][pubkeyid]) } return nil diff --git a/swarm/pss/client/client_test.go b/swarm/pss/client/client_test.go index f36069877..48edc6cce 100644 --- a/swarm/pss/client/client_test.go +++ b/swarm/pss/client/client_test.go @@ -31,7 +31,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/node" "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/simulations" "github.com/ethereum/go-ethereum/p2p/simulations/adapters" "github.com/ethereum/go-ethereum/rpc" @@ -232,12 +232,11 @@ func setupNetwork(numnodes int) (clients []*rpc.Client, err error) { func newServices() adapters.Services { stateStore := state.NewInmemoryStore() - kademlias := make(map[discover.NodeID]*network.Kademlia) - kademlia := func(id discover.NodeID) *network.Kademlia { + kademlias := make(map[enode.ID]*network.Kademlia) + kademlia := func(id enode.ID) *network.Kademlia { if k, ok := kademlias[id]; ok { return k } - addr := network.NewAddrFromNodeID(id) params := network.NewKadParams() params.MinProxBinSize = 2 params.MaxBinSize = 3 @@ -245,7 +244,7 @@ func newServices() adapters.Services { params.MaxRetries = 1000 params.RetryExponent = 2 params.RetryInterval = 1000000 - kademlias[id] = network.NewKademlia(addr.Over(), params) + kademlias[id] = network.NewKademlia(id[:], params) return kademlias[id] } return adapters.Services{ @@ -269,7 +268,7 @@ func newServices() adapters.Services { return ps, nil }, "bzz": func(ctx *adapters.ServiceContext) (node.Service, error) { - addr := network.NewAddrFromNodeID(ctx.Config.ID) + addr := network.NewAddr(ctx.Config.Node()) hp := network.NewHiveParams() hp.Discovery = false config := &network.BzzConfig{ |