Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
network: revert back check for light nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
nonsense committed Sep 12, 2019
1 parent 8b5ff92 commit ecf0094
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion network/retrieval/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,12 @@ func (r *Retrieval) findPeer(ctx context.Context, req *storage.Request) (retPeer
r.kad.EachConn(req.Addr[:], 255, func(p *network.Peer, po int) bool {
id := p.ID()

if !p.HasCap("bzz-retrieve") {
if !p.HasCap(Spec.Name) {
return true
}

// skip light nodes, even though they support `bzz-retrieve` protocol
if p.LightNode {
return true
}

Expand Down
4 changes: 2 additions & 2 deletions network/retrieval/retrieve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func TestRequestFromPeers(t *testing.T) {

addr := network.RandomAddr()
to := network.NewKademlia(addr.OAddr, network.NewKadParams())
protocolsPeer := protocols.NewPeer(p2p.NewPeer(dummyPeerID, "dummy", []p2p.Cap{p2p.Cap{Name: "bzz-retrieve", Version: 1}}), nil, nil)
protocolsPeer := protocols.NewPeer(p2p.NewPeer(dummyPeerID, "dummy", []p2p.Cap{{Name: "bzz-retrieve", Version: 1}}), nil, nil)
peer := network.NewPeer(&network.BzzPeer{
BzzAddr: network.RandomAddr(),
LightNode: false,
Expand Down Expand Up @@ -262,7 +262,7 @@ func TestRequestFromPeersWithLightNode(t *testing.T) {
addr := network.RandomAddr()
to := network.NewKademlia(addr.OAddr, network.NewKadParams())

protocolsPeer := protocols.NewPeer(p2p.NewPeer(dummyPeerID, "dummy", nil), nil, nil)
protocolsPeer := protocols.NewPeer(p2p.NewPeer(dummyPeerID, "dummy", []p2p.Cap{{Name: "bzz-retrieve", Version: 1}}), nil, nil)

// setting up a lightnode
peer := network.NewPeer(&network.BzzPeer{
Expand Down

0 comments on commit ecf0094

Please sign in to comment.