Skip to content

Commit

Permalink
add provider record addresses to peerstore
Browse files Browse the repository at this point in the history
fixes issue #868
  • Loading branch information
dennis-tra committed Aug 22, 2023
1 parent ee95d1a commit bd84088
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/libp2p/go-libp2p-kad-dht/internal"
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
recpb "github.com/libp2p/go-libp2p-record/pb"
"github.com/multiformats/go-base32"
)

// dhthandler specifies the signature of functions that handle DHT messages.
Expand Down Expand Up @@ -347,6 +346,7 @@ func (dht *IpfsDHT) handleAddProvider(ctx context.Context, p peer.ID, pmes *pb.M
// add provider should use the address given in the message
pinfos := pb.PBPeersToPeerInfos(pmes.GetProviderPeers())
for _, pi := range pinfos {
pi := pi
if pi.ID != p {
// we should ignore this provider record! not from originator.
// (we should sign them and check signature later...)
Expand All @@ -359,7 +359,7 @@ func (dht *IpfsDHT) handleAddProvider(ctx context.Context, p peer.ID, pmes *pb.M
continue
}

dht.providerStore.AddProvider(ctx, key, peer.AddrInfo{ID: p})
dht.providerStore.AddProvider(ctx, key, *pi)
}

return nil, nil
Expand Down

0 comments on commit bd84088

Please sign in to comment.