mark bootstrap peers as protected
This commit is contained in:
parent
6cb6167393
commit
ff5b086f58
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user