diff --git a/node/modules/lp2p/libp2p.go b/node/modules/lp2p/libp2p.go index d9ed6ee83..f14368aa4 100644 --- a/node/modules/lp2p/libp2p.go +++ b/node/modules/lp2p/libp2p.go @@ -4,6 +4,7 @@ import ( "crypto/rand" "time" + "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/types" "golang.org/x/xerrors" @@ -75,6 +76,15 @@ func ConnectionManager(low, high uint, grace time.Duration, protected []string) cm.Protect(pid, "config-prot") } + infos, err := build.BuiltinBootstrap() + if err != nil { + return Libp2pOpts{}, xerrors.Errorf("failed to get bootstrap peers: %w", err) + } + + for _, inf := range infos { + cm.Protect(inf.ID, "bootstrap") + } + return Libp2pOpts{ Opts: []libp2p.Option{libp2p.ConnectionManager(cm)}, }, nil