Skip to content

Commit

Permalink
Merge pull request #6063 from filecoin-project/opt/elvindu/remove-boo…
Browse files Browse the repository at this point in the history
…tstrap-MinPeerThreshold-field

remove MinPeerThreshold in bootstrap config because it is not used /删除MinPeerThreshold字段从bootstrap配置,没有用到
  • Loading branch information
simlecode authored Aug 15, 2023
2 parents 20ffb74 + 97b04d5 commit 39d041d
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 32 deletions.
3 changes: 0 additions & 3 deletions app/node/test/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ func NewNodeBuilder(tb testing.TB) *NodeBuilder {
c.API.APIAddress = "/ip4/127.0.0.1/tcp/0"
c.Swarm.Address = "/ip4/0.0.0.0/tcp/0"
}),
node.ConfigOpt(func(c *config.Config) {
c.Bootstrap.MinPeerThreshold = 0
}),
},
builderOpts: []node.BuilderOpt{
node.SetWalletPassword([]byte("test-password")),
Expand Down
3 changes: 1 addition & 2 deletions fixtures/networks/butterfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ func ButterflySnapNet() *NetworkConf {
"/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWD5mtdmjHQ1Puj9Md7SEfoa7kWMpwqUhAKsyYsBP56LQC",
"/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWEoYPkm6o87ES6AppFY7d7WHJUQg7XVPRAyQZjEU31efQ",
},
MinPeerThreshold: 0,
Period: "30s",
Period: "30s",
},
Network: config.NetworkParamsConfig{
DevNet: true,
Expand Down
3 changes: 1 addition & 2 deletions fixtures/networks/calibration.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ func Calibration() *NetworkConf {
"/dns4/bootstrap-2.calibration.fildev.network/tcp/1347/p2p/12D3KooWNRxTHUn8bf7jz1KEUPMc2dMgGfa4f8ZJTsquVSn3vHCG",
"/dns4/bootstrap-3.calibration.fildev.network/tcp/1347/p2p/12D3KooWFWUqE9jgXvcKHWieYs9nhyp6NF4ftwLGAHm4sCv73jjK",
},
MinPeerThreshold: 0,
Period: "30s",
Period: "30s",
},
Network: config.NetworkParamsConfig{
DevNet: true,
Expand Down
3 changes: 1 addition & 2 deletions fixtures/networks/forcenet.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ func ForceNet() *NetworkConf {
Bootstrap: config.BootstrapConfig{
Addresses: []string{},

MinPeerThreshold: 0,
Period: "30s",
Period: "30s",
},
Network: config.NetworkParamsConfig{
DevNet: true,
Expand Down
3 changes: 1 addition & 2 deletions fixtures/networks/hyperspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ func HyperspaceNet() *NetworkConf {
"/dns4/ca0.bootstrap.hyperspace.yoga/tcp/31000/p2p/12D3KooWNJ4evKioh6gexD4fyvyeFecNtp2oTEPTyp3jtSQ3pWaP",
"/dns4/sg0.bootstrap.hyperspace.yoga/tcp/31000/p2p/12D3KooWCENec46HHByaJKzbjSqz9TqVdSxSAdi9FKNwdMvfw3vp",
},
MinPeerThreshold: 0,
Period: "30s",
Period: "30s",
},
Network: config.NetworkParamsConfig{
DevNet: true,
Expand Down
5 changes: 2 additions & 3 deletions fixtures/networks/integrationtestnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import (
func IntegrationNet() *NetworkConf {
return &NetworkConf{
Bootstrap: config.BootstrapConfig{
Addresses: []string{},
MinPeerThreshold: 0,
Period: "30s",
Addresses: []string{},
Period: "30s",
},
Network: config.NetworkParamsConfig{
NetworkType: types.Integrationnet,
Expand Down
3 changes: 1 addition & 2 deletions fixtures/networks/interopnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ func InteropNet() *NetworkConf {
"/dns4/bootstrap-0.interop.fildev.network/tcp/1347/p2p/12D3KooWDpppr8csCNvEPnD2Z83KTPdBTM7iJhL66qK8LK3bB5NU",
"/dns4/bootstrap-1.interop.fildev.network/tcp/1347/p2p/12D3KooWR3K1sXWoDYcXWqDF26mFEM1o1g7e7fcVR3NYE7rn24Gs",
},
MinPeerThreshold: 0,
Period: "30s",
Period: "30s",
},
Network: config.NetworkParamsConfig{
DevNet: true,
Expand Down
3 changes: 1 addition & 2 deletions fixtures/networks/mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ func Mainnet() *NetworkConf {
"/dns4/bootstrap-1.ipfsmain.cn/tcp/34723/p2p/12D3KooWMKxMkD5DMpSWsW7dBddKxKT7L2GgbNuckz9otxvkvByP",
"/dns4/bootstarp-0.1475.io/tcp/61256/p2p/12D3KooWRzCVDwHUkgdK7eRgnoXbjDAELhxPErjHzbRLguSV1aRt",
},
MinPeerThreshold: 1,
Period: "30s",
Period: "30s",
},
Network: config.NetworkParamsConfig{
DevNet: false,
Expand Down
5 changes: 2 additions & 3 deletions fixtures/networks/net_2k.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import (
func Net2k() *NetworkConf {
return &NetworkConf{
Bootstrap: config.BootstrapConfig{
Addresses: []string{},
MinPeerThreshold: 0,
Period: "30s",
Addresses: []string{},
Period: "30s",
},
Network: config.NetworkParamsConfig{
DevNet: true,
Expand Down
3 changes: 1 addition & 2 deletions fixtures/networks/wallaby.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ func WallabyNet() *NetworkConf {
"/dns4/ca0.bootstrap.wallaby.yoga/tcp/41000/p2p/12D3KooWQAupDxeHoLzmc617FzhWnHHWEt8e2fNfccqByT5mHWPp",
"/dns4/sg0.bootstrap.wallaby.yoga/tcp/41000/p2p/12D3KooWAkSaZCXSngvgSi4ufVModcExCysnS3JhG6nnprPjVV4o",
},
MinPeerThreshold: 0,
Period: "30s",
Period: "30s",
},
Network: config.NetworkParamsConfig{
DevNet: true,
Expand Down
10 changes: 4 additions & 6 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ func newDefaultSwarmConfig() *SwarmConfig {

// BootstrapConfig holds all configuration options related to bootstrap nodes
type BootstrapConfig struct {
Addresses []string `json:"addresses"`
MinPeerThreshold int `json:"minPeerThreshold"`
Period string `json:"period,omitempty"`
Addresses []string `json:"addresses"`
Period string `json:"period,omitempty"`
}

func (bsc *BootstrapConfig) AddPeers(peers ...string) {
Expand All @@ -154,9 +153,8 @@ func (bsc *BootstrapConfig) AddPeers(peers ...string) {
// TODO: provide bootstrap node addresses
func newDefaultBootstrapConfig() *BootstrapConfig {
return &BootstrapConfig{
Addresses: []string{},
MinPeerThreshold: 3, // TODO: we don't actually have an bootstrap peers yet.
Period: "1m",
Addresses: []string{},
Period: "1m",
}
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@ path = "mushroom-mushroom"}`

err := cfg.Set("bootstrap.period", `"3m"`)
assert.NoError(t, err)
err = cfg.Set("bootstrap.minPeerThreshold", `5`)
assert.NoError(t, err)
assert.Equal(t, cfg.Bootstrap.Period, "3m")
})
}
Expand Down
1 change: 0 additions & 1 deletion pkg/config/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ func SanityCheck(t *testing.T, cfgJSON string) {
assert.True(t, strings.Contains(cfgJSON, "http://localhost:8080"))
assert.True(t, strings.Contains(cfgJSON, "bootstrap"))
assert.True(t, strings.Contains(cfgJSON, "bootstrap"))
assert.True(t, strings.Contains(cfgJSON, "\"minPeerThreshold\": 3"))
}

0 comments on commit 39d041d

Please sign in to comment.