Merge pull request #46 from status-im/feature/geth-cluster

Adds references to cluster nodes
This commit is contained in:
Victor Farazdagi 2016-10-12 01:05:36 +03:00 committed by GitHub
commit b55346c37e
3 changed files with 26 additions and 3 deletions

View File

@ -1,3 +1,7 @@
[
"enode://4e2bb6b09aa34375ae2df23fa063edfe7aaec952dba972449158ae0980a4abd375aca3c06a519d4f562ff298565afd288a0ed165944974b2557e6ff2c31424de@138.68.73.175:30303"
"enode://e15869ba08a25e49be7568b951e15af5d77a472c8e4104a14a4951f99936d65f91240d5b5f23674aee44f1ac09d8adfc6a9bff75cd8c2df73a26442f313f2da4@162.243.63.248:30303",
"enode://efe4e6899e05237180c0970aedb81cb5aecf5b200779c7c9e1f955783e8299b364c0b981c03f4c36ad5328ef972b417afde260bbf2c5a8db37ba7f5738033952@198.199.105.122:30303",
"enode://5a5839435f48d1e3f2f907e4582f0a134e0b7857afe507073978ca32cf09ea54989dac433605047d0bc4cd19a8c80affac6876069014283aa7c7bb4954d0e623@95.85.40.211:30303",
"enode://2f05d430b4cb1c0e2a0772d48da3a034f1b596ea7163ab80d3404802d10b7d55bde323897c2be0d36026181e1a68510ea1f42a646ef9494c27e61f61e4088b7d@188.166.229.119:30303",
"enode://ad61a21f83f12b0ca494611650f5e4b6427784e7c62514dcb729a3d65106de6f12836813acf39bdc35c12ecfd0e230723678109fd4e7091ce389697bd7da39b4@139.59.212.114:30303"
]

View File

@ -11,6 +11,8 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"path/filepath"
"runtime"
"sync"
@ -165,6 +167,9 @@ func (m *NodeManager) RunNode() {
return client
})
// @TODO Remove after LES supports discover out of box
m.populateStaticPeers()
m.onNodeStarted() // node started, notify listeners
m.currentNode.Wait()
}()
@ -292,3 +297,19 @@ func makeDefaultExtra() []byte {
return extra
}
func (m *NodeManager) populateStaticPeers() {
// manually add static nodes (LES auto-discovery is not stable yet)
configFile, err := ioutil.ReadFile(filepath.Join("../data", "static-nodes.json"))
if err != nil {
return
}
var enodes []string
if err = json.Unmarshal(configFile, &enodes); err != nil {
return
}
for _, enode := range enodes {
m.AddPeer(enode)
}
}

View File

@ -129,8 +129,6 @@ func PrepareTestNode() (err error) {
panic(ErrInvalidGethNode)
}
manager.AddPeer("enode://409772c7dea96fa59a912186ad5bcdb5e51b80556b3fe447d940f99d9eaadb51d4f0ffedb68efad232b52475dd7bd59b51cee99968b3cc79e2d5684b33c4090c@139.162.166.59:30303")
if syncRequired {
glog.V(logger.Warn).Infof("Sync is required, it will take %d seconds", TestNodeSyncSeconds)
time.Sleep(TestNodeSyncSeconds * time.Second) // LES syncs headers, so that we are up do date when it is done