Skip to content

Commit 0bb80cc

Browse files
committed
Fix panic due to unassigned bootstrap config functions
Need this because of ipfs/kubo#10030. Can be removed when ipfs/kubo#10029 is available.
1 parent 496d962 commit 0bb80cc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

assigner/command/daemon.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package command
22

33
import (
4+
"context"
45
"errors"
56
"fmt"
67
"io"
@@ -17,6 +18,7 @@ import (
1718
"github.com/libp2p/go-libp2p"
1819
"github.com/libp2p/go-libp2p/core/host"
1920
"github.com/libp2p/go-libp2p/core/network"
21+
"github.com/libp2p/go-libp2p/core/peer"
2022
"github.com/multiformats/go-multiaddr"
2123
"github.com/urfave/cli/v2"
2224
)
@@ -234,6 +236,10 @@ func startBootstrapper(cfg sticfg.Bootstrap, p2pHost host.Host) (io.Closer, erro
234236
bootCfg := bootstrap.BootstrapConfigWithPeers(addrs)
235237
bootCfg.MinPeerThreshold = cfg.MinimumPeers
236238

239+
// Kubo does not allow these to be nil, so set empty functions.
240+
bootCfg.LoadBackupBootstrapPeers = func(_ context.Context) []peer.AddrInfo { return nil }
241+
bootCfg.SaveBackupBootstrapPeers = func(_ context.Context, _ []peer.AddrInfo) {}
242+
237243
return bootstrap.Bootstrap(p2pHost.ID(), p2pHost, nil, bootCfg)
238244
}
239245

0 commit comments

Comments
 (0)