Skip to content

Commit

Permalink
Fix panic due to unassigned bootstrap config functions (#2191)
Browse files Browse the repository at this point in the history
Need this because of ipfs/kubo#10030.

Can be removed when ipfs/kubo#10029 is available.
  • Loading branch information
gammazero authored Aug 2, 2023
1 parent 496d962 commit c06ba7c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions assigner/command/daemon.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package command

import (
"context"
"errors"
"fmt"
"io"
Expand All @@ -17,6 +18,7 @@ import (
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/multiformats/go-multiaddr"
"github.com/urfave/cli/v2"
)
Expand Down Expand Up @@ -234,6 +236,10 @@ func startBootstrapper(cfg sticfg.Bootstrap, p2pHost host.Host) (io.Closer, erro
bootCfg := bootstrap.BootstrapConfigWithPeers(addrs)
bootCfg.MinPeerThreshold = cfg.MinimumPeers

// Kubo does not allow these to be nil, so set empty functions.
bootCfg.LoadBackupBootstrapPeers = func(_ context.Context) []peer.AddrInfo { return nil }
bootCfg.SaveBackupBootstrapPeers = func(_ context.Context, _ []peer.AddrInfo) {}

return bootstrap.Bootstrap(p2pHost.ID(), p2pHost, nil, bootCfg)
}

Expand Down

0 comments on commit c06ba7c

Please sign in to comment.