Configure mainnet nodes (#701)

Add mainnet static peers to static/config/staticpeers.json.
This commit is contained in:
Adam Babik 2018-02-26 19:36:04 +01:00 committed by GitHub
parent eca5e04cc4
commit 0a15c9ff9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 155 additions and 241 deletions

View File

@ -17,7 +17,7 @@ XGOVERSION ?= 1.9.2
XGOIMAGE = statusteam/xgo:$(XGOVERSION)
XGOIMAGEIOSSIM = statusteam/xgo-ios-simulator:$(XGOVERSION)
DOCKER_IMAGE_NAME ?= status-go
DOCKER_IMAGE_NAME ?= statusteam/status-go
DOCKER_TEST_WORKDIR = /go/src/github.com/status-im/status-go/
DOCKER_TEST_IMAGE = golang:1.9

View File

@ -156,6 +156,17 @@ func startCollectingStats(interruptCh <-chan struct{}, nodeManager common.NodeMa
}()
server := metrics.NewMetricsServer(*statsAddr)
defer func() {
// server may be nil if `-stats` flag is used
// but the binary is compiled without metrics enabled
if server == nil {
return
}
if err := server.Shutdown(context.TODO()); err != nil {
log.Printf("Failed to shutdown metrics server: %v", err)
}
}()
go func() {
// server may be nil if `-stats` flag is used
// but the binary is compiled without metrics enabled
@ -172,12 +183,6 @@ func startCollectingStats(interruptCh <-chan struct{}, nodeManager common.NodeMa
}()
<-interruptCh
if server != nil {
if err := server.Shutdown(context.TODO()); err != nil {
log.Printf("Failed to shutdown metrics server: %v", err)
}
}
}
// makeNodeConfig parses incoming CLI options and returns node configuration object

View File

@ -543,15 +543,15 @@ func (c *NodeConfig) updateBootClusterConfig() error {
Dev subClusterConfig `json:"dev"`
}
chtFile, err := static.Asset("config/cht.json")
chtFile, err := static.Asset("config/staticpeers.json")
if err != nil {
return fmt.Errorf("cht.json could not be loaded: %s", err)
return fmt.Errorf("staticpeers.json could not be loaded: %s", err)
}
var clusters []clusterConfig
err = json.Unmarshal(chtFile, &clusters)
if err != nil {
return fmt.Errorf("failed to unmarshal cht.json: %s", err)
return fmt.Errorf("failed to unmarshal staticpeers.json: %s", err)
}
for _, cluster := range clusters {

View File

@ -221,31 +221,26 @@ var loadConfigTestCases = []struct {
"DataDir": "$TMPDIR"
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
// Bootnodes for dev and prod modes are the same so no need for a separate Ropsten Prod test.
require.NoError(t, err)
require.True(t, nodeConfig.BootClusterConfig.Enabled, "boot cluster is expected to be enabled by default")
enodes := nodeConfig.BootClusterConfig.BootNodes
expectedEnodes := []string{
"enode://7ab298cedc4185a894d21d8a4615262ec6bdce66c9b6783878258e0d5b31013d30c9038932432f70e5b2b6a5cd323bf820554fcb22fbc7b45367889522e9c449@51.15.63.93:30303",
"enode://f59e8701f18c79c5cbc7618dc7bb928d44dc2f5405c7d693dad97da2d8585975942ec6fd36d3fe608bfdc7270a34a4dd00f38cfe96b2baa24f7cd0ac28d382a1@51.15.79.88:30303",
"enode://e2a3587b7b41acfc49eddea9229281905d252efba0baf565cf6276df17faf04801b7879eead757da8b5be13b05f25e775ab6d857ff264bc53a89c027a657dd10@51.15.45.114:30303",
"enode://fe991752c4ceab8b90608fbf16d89a5f7d6d1825647d4981569ebcece1b243b2000420a5db721e214231c7a6da3543fa821185c706cbd9b9be651494ec97f56a@51.15.67.119:30303",
"enode://482484b9198530ee2e00db89791823244ca41dcd372242e2e1297dd06f6d8dd357603960c5ad9cc8dc15fcdf0e4edd06b7ad7db590e67a0b54f798c26581ebd7@51.15.75.138:30303",
"enode://9e99e183b5c71d51deb16e6b42ac9c26c75cfc95fff9dfae828b871b348354cbecf196dff4dd43567b26c8241b2b979cb4ea9f8dae2d9aacf86649dafe19a39a@51.15.79.176:30303",
"enode://12d52c3796700fb5acff2c7d96df7bbb6d7109b67f3442ee3d99ac1c197016cddb4c3568bbeba05d39145c59c990cd64f76bc9b00d4b13f10095c49507dd4cf9@51.15.63.110:30303",
"enode://0f7c65277f916ff4379fe520b875082a56e587eb3ce1c1567d9ff94206bdb05ba167c52272f20f634cd1ebdec5d9dfeb393018bfde1595d8e64a717c8b46692f@51.15.54.150:30303",
"enode://e006f0b2dc98e757468b67173295519e9b6d5ff4842772acb18fd055c620727ab23766c95b8ee1008dea9e8ef61e83b1515ddb3fb56dbfb9dbf1f463552a7c9f@212.47.237.127:30303",
"enode://d40871fc3e11b2649700978e06acd68a24af54e603d4333faecb70926ca7df93baa0b7bf4e927fcad9a7c1c07f9b325b22f6d1730e728314d0e4e6523e5cebc2@51.15.132.235:30303",
"enode://ea37c9724762be7f668e15d3dc955562529ab4f01bd7951f0b3c1960b75ecba45e8c3bb3c8ebe6a7504d9a40dd99a562b13629cc8e5e12153451765f9a12a61d@163.172.189.205:30303",
"enode://88c2b24429a6f7683fbfd06874ae3f1e7c8b4a5ffb846e77c705ba02e2543789d66fc032b6606a8d8888eb6239a2abe5897ce83f78dcdcfcb027d6ea69aa6fe9@163.172.157.61:30303",
"enode://ce6854c2c77a8800fcc12600206c344b8053bb90ee3ba280e6c4f18f3141cdc5ee80bcc3bdb24cbc0e96dffd4b38d7b57546ed528c00af6cd604ab65c4d528f6@163.172.153.124:30303",
"enode://00ae60771d9815daba35766d463a82a7b360b3a80e35ab2e0daa25bdc6ca6213ff4c8348025e7e1a908a8f58411a364fe02a0fb3c2aa32008304f063d8aaf1a2@163.172.132.85:30303",
"enode://86ebc843aa51669e08e27400e435f957918e39dc540b021a2f3291ab776c88bbda3d97631639219b6e77e375ab7944222c47713bdeb3251b25779ce743a39d70@212.47.254.155:30303",
"enode://a1ef9ba5550d5fac27f7cbd4e8d20a643ad75596f307c91cd6e7f85b548b8a6bf215cca436d6ee436d6135f9fe51398f8dd4c0bd6c6a0c332ccb41880f33ec12@51.15.218.125:30303",
}
require.Equal(t, expectedEnodes, enodes)
require.True(t, len(enodes) >= 3)
},
},
{
`default boot cluster (Ropsten Prod)`,
`{
"NetworkId": 3,
"DataDir": "$TMPDIR",
"DevMode": false
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
require.NoError(t, err)
require.True(t, nodeConfig.BootClusterConfig.Enabled, "boot cluster is expected to be enabled by default")
enodes := nodeConfig.BootClusterConfig.BootNodes
require.True(t, len(enodes) >= 3)
},
},
{
@ -262,39 +257,6 @@ var loadConfigTestCases = []struct {
require.False(t, nodeConfig.BootClusterConfig.Enabled, "boot cluster is expected to be disabled")
},
},
{
`select boot cluster (Ropsten Prod)`,
`{
"NetworkId": 3,
"DataDir": "$TMPDIR",
"DevMode": false
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
require.NoError(t, err)
require.True(t, nodeConfig.BootClusterConfig.Enabled, "boot cluster is expected to be enabled by default")
enodes := nodeConfig.BootClusterConfig.BootNodes
expectedEnodes := []string{
"enode://7ab298cedc4185a894d21d8a4615262ec6bdce66c9b6783878258e0d5b31013d30c9038932432f70e5b2b6a5cd323bf820554fcb22fbc7b45367889522e9c449@51.15.63.93:30303",
"enode://f59e8701f18c79c5cbc7618dc7bb928d44dc2f5405c7d693dad97da2d8585975942ec6fd36d3fe608bfdc7270a34a4dd00f38cfe96b2baa24f7cd0ac28d382a1@51.15.79.88:30303",
"enode://e2a3587b7b41acfc49eddea9229281905d252efba0baf565cf6276df17faf04801b7879eead757da8b5be13b05f25e775ab6d857ff264bc53a89c027a657dd10@51.15.45.114:30303",
"enode://fe991752c4ceab8b90608fbf16d89a5f7d6d1825647d4981569ebcece1b243b2000420a5db721e214231c7a6da3543fa821185c706cbd9b9be651494ec97f56a@51.15.67.119:30303",
"enode://482484b9198530ee2e00db89791823244ca41dcd372242e2e1297dd06f6d8dd357603960c5ad9cc8dc15fcdf0e4edd06b7ad7db590e67a0b54f798c26581ebd7@51.15.75.138:30303",
"enode://9e99e183b5c71d51deb16e6b42ac9c26c75cfc95fff9dfae828b871b348354cbecf196dff4dd43567b26c8241b2b979cb4ea9f8dae2d9aacf86649dafe19a39a@51.15.79.176:30303",
"enode://12d52c3796700fb5acff2c7d96df7bbb6d7109b67f3442ee3d99ac1c197016cddb4c3568bbeba05d39145c59c990cd64f76bc9b00d4b13f10095c49507dd4cf9@51.15.63.110:30303",
"enode://0f7c65277f916ff4379fe520b875082a56e587eb3ce1c1567d9ff94206bdb05ba167c52272f20f634cd1ebdec5d9dfeb393018bfde1595d8e64a717c8b46692f@51.15.54.150:30303",
"enode://e006f0b2dc98e757468b67173295519e9b6d5ff4842772acb18fd055c620727ab23766c95b8ee1008dea9e8ef61e83b1515ddb3fb56dbfb9dbf1f463552a7c9f@212.47.237.127:30303",
"enode://d40871fc3e11b2649700978e06acd68a24af54e603d4333faecb70926ca7df93baa0b7bf4e927fcad9a7c1c07f9b325b22f6d1730e728314d0e4e6523e5cebc2@51.15.132.235:30303",
"enode://ea37c9724762be7f668e15d3dc955562529ab4f01bd7951f0b3c1960b75ecba45e8c3bb3c8ebe6a7504d9a40dd99a562b13629cc8e5e12153451765f9a12a61d@163.172.189.205:30303",
"enode://88c2b24429a6f7683fbfd06874ae3f1e7c8b4a5ffb846e77c705ba02e2543789d66fc032b6606a8d8888eb6239a2abe5897ce83f78dcdcfcb027d6ea69aa6fe9@163.172.157.61:30303",
"enode://ce6854c2c77a8800fcc12600206c344b8053bb90ee3ba280e6c4f18f3141cdc5ee80bcc3bdb24cbc0e96dffd4b38d7b57546ed528c00af6cd604ab65c4d528f6@163.172.153.124:30303",
"enode://00ae60771d9815daba35766d463a82a7b360b3a80e35ab2e0daa25bdc6ca6213ff4c8348025e7e1a908a8f58411a364fe02a0fb3c2aa32008304f063d8aaf1a2@163.172.132.85:30303",
"enode://86ebc843aa51669e08e27400e435f957918e39dc540b021a2f3291ab776c88bbda3d97631639219b6e77e375ab7944222c47713bdeb3251b25779ce743a39d70@212.47.254.155:30303",
"enode://a1ef9ba5550d5fac27f7cbd4e8d20a643ad75596f307c91cd6e7f85b548b8a6bf215cca436d6ee436d6135f9fe51398f8dd4c0bd6c6a0c332ccb41880f33ec12@51.15.218.125:30303",
}
require.Equal(t, expectedEnodes, enodes)
},
},
{
`select boot cluster (Rinkeby Dev)`,
`{
@ -306,12 +268,7 @@ var loadConfigTestCases = []struct {
require.True(t, nodeConfig.BootClusterConfig.Enabled, "boot cluster is expected to be enabled by default")
enodes := nodeConfig.BootClusterConfig.BootNodes
expectedEnodes := []string{
"enode://7512c8f6e7ffdcc723cf77e602a1de9d8cc2e8ad35db309464819122cd773857131aee390fec33894db13da730c8432bb248eed64039e3810e156e979b2847cb@51.15.78.243:30303",
"enode://1cc27a5a41130a5c8b90db5b2273dc28f7b56f3edfc0dcc57b665d451274b26541e8de49ea7a074281906a82209b9600239c981163b6ff85c3038a8e2bc5d8b8@51.15.68.93:30303",
"enode://798d17064141b8f88df718028a8272b943d1cb8e696b3dab56519c70b77b1d3469b56b6f4ce3788457646808f5c7299e9116626f2281f30b959527b969a71e4f@51.15.75.244:30303",
}
require.Equal(t, expectedEnodes, enodes)
require.True(t, len(enodes) >= 3)
},
},
{
@ -326,16 +283,11 @@ var loadConfigTestCases = []struct {
require.True(t, nodeConfig.BootClusterConfig.Enabled, "boot cluster is expected to be enabled by default")
enodes := nodeConfig.BootClusterConfig.BootNodes
expectedEnodes := []string{
"enode://fda3f6273a0f2da4ac5858d1f52e5afaf9def281121be3d37558c67d4d9ca26c6ad7a0520b2cd7454120fb770e86d5760487c9924b2166e65485f606e56d60fc@51.15.69.144:30303",
"enode://ba41aa829287a0a9076d9bffed97c8ce2e491b99873288c9e886f16fd575306ac6c656db4fbf814f5a9021aec004ffa9c0ae8650f92fd10c12eeb7c364593eb3@51.15.69.147:30303",
"enode://28ecf5272b560ca951f4cd7f1eb8bd62da5853b026b46db432c4b01797f5b0114819a090a72acd7f32685365ecd8e00450074fa0673039aefe10f3fb666e0f3f@51.15.76.249:30303",
}
require.Equal(t, expectedEnodes, enodes)
require.True(t, len(enodes) >= 3)
},
},
{
`select boot cluster (Homestead Dev)`,
`select boot cluster (Mainnet dev)`,
`{
"NetworkId": 1,
"DataDir": "$TMPDIR"
@ -345,12 +297,11 @@ var loadConfigTestCases = []struct {
require.True(t, nodeConfig.BootClusterConfig.Enabled, "boot cluster is expected to be enabled by default")
enodes := nodeConfig.BootClusterConfig.BootNodes
expectedEnodes := []string{}
require.Equal(t, expectedEnodes, enodes)
require.True(t, len(enodes) >= 2)
},
},
{
`select boot cluster (Homestead Prod)`,
`select boot cluster (Mainnet Prod)`,
`{
"NetworkId": 1,
"DataDir": "$TMPDIR",
@ -361,8 +312,7 @@ var loadConfigTestCases = []struct {
require.True(t, nodeConfig.BootClusterConfig.Enabled, "boot cluster is expected to be enabled by default")
enodes := nodeConfig.BootClusterConfig.BootNodes
expectedEnodes := []string{}
require.Equal(t, expectedEnodes, enodes)
require.True(t, len(enodes) >= 2)
},
},
{

File diff suppressed because one or more lines are too long

View File

@ -65,10 +65,26 @@
"networkID": 1,
"genesisHash": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
"prod": {
"bootnodes": []
"bootnodes": [
"enode://71bb01b58165e3262aea2d3b06dbf9abb8d5512d96e5000e7e41ab2138b47be685935d3eb119fc25e1413db00d8db231fd9d59555a1cd75229821559b6a4eb51@51.15.85.243:30303",
"enode://7afd119c549a7ab02b3f7bd77ef3490b6d660d5c49d0734a0c8bb23195ced4ace0bf5cde673cd5cfd07dd8d759277f3d8408eb73dc3c217bbe00f0027d06eee9@51.15.85.243:30305",
"enode://da8af0869e4e8047f21c1ac016b94a7b7d8e935dddd28d4272f88a1ceaee7c15e7deec9b6fd195ed3bc43748893111ebf2b2479ff44a8025ab8d598f3c97b589@51.15.85.243:30307",
"enode://80ce1b1fd0473d1acf2c94d0c852ea6a703a4a4538aa2e39834303995d1dec032b71a2f3368cea0043145a84f8f98a1c7fe99484707ede671d23eb27b7792524@163.172.176.22:30303",
"enode://8aa650ae7145ce65915c17ab0d369a9fcf3b16bc932a603d1bf9edf782010b54a0a069bbc607a3cf32e644276882c0d5b9b2d7e7bda7c7a10e635515746a6aa4@163.172.176.22:30305",
"enode://277b7896b63baae5f0e31575df5cd4912a554e50af33c0abecb95acd56000f0f69aeff2569db20b411fcb53cfd39f0eade27b8c57006b094b4d5c3091ed13458@163.172.176.22:30307"
]
},
"dev": {
"bootnodes": []
"bootnodes": [
"enode://71bb01b58165e3262aea2d3b06dbf9abb8d5512d96e5000e7e41ab2138b47be685935d3eb119fc25e1413db00d8db231fd9d59555a1cd75229821559b6a4eb51@51.15.85.243:30303",
"enode://7afd119c549a7ab02b3f7bd77ef3490b6d660d5c49d0734a0c8bb23195ced4ace0bf5cde673cd5cfd07dd8d759277f3d8408eb73dc3c217bbe00f0027d06eee9@51.15.85.243:30305",
"enode://da8af0869e4e8047f21c1ac016b94a7b7d8e935dddd28d4272f88a1ceaee7c15e7deec9b6fd195ed3bc43748893111ebf2b2479ff44a8025ab8d598f3c97b589@51.15.85.243:30307",
"enode://80ce1b1fd0473d1acf2c94d0c852ea6a703a4a4538aa2e39834303995d1dec032b71a2f3368cea0043145a84f8f98a1c7fe99484707ede671d23eb27b7792524@163.172.176.22:30303",
"enode://8aa650ae7145ce65915c17ab0d369a9fcf3b16bc932a603d1bf9edf782010b54a0a069bbc607a3cf32e644276882c0d5b9b2d7e7bda7c7a10e635515746a6aa4@163.172.176.22:30305",
"enode://277b7896b63baae5f0e31575df5cd4912a554e50af33c0abecb95acd56000f0f69aeff2569db20b411fcb53cfd39f0eade27b8c57006b094b4d5c3091ed13458@163.172.176.22:30307"
]
}
}
]