Skip to content

Commit

Permalink
migrate to datastore-backed peerstore.
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Raúl Kripalani <[email protected]>
  • Loading branch information
raulk committed Mar 14, 2019
1 parent e922edd commit 7704e8f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
p2phost "github.com/libp2p/go-libp2p-host"
peer "github.com/libp2p/go-libp2p-peer"
pstore "github.com/libp2p/go-libp2p-peerstore"
pstoremem "github.com/libp2p/go-libp2p-peerstore/pstoremem"
pstoreds "github.com/libp2p/go-libp2p-peerstore/pstoreds"
record "github.com/libp2p/go-libp2p-record"
)

Expand Down Expand Up @@ -141,11 +141,16 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {

ctx = metrics.CtxScope(ctx, "ipfs")

ps, err := pstoreds.NewPeerstore(ctx, cfg.Repo.Datastore(), pstoreds.DefaultOpts())
if err != nil {
return nil, err
}

n := &IpfsNode{
IsOnline: cfg.Online,
Repo: cfg.Repo,
ctx: ctx,
Peerstore: pstoremem.NewPeerstore(),
Peerstore: ps,
}

n.RecordValidator = record.NamespacedValidator{
Expand Down

0 comments on commit 7704e8f

Please sign in to comment.