params, geth, cmd: Scaleway cluster enabled

This commit is contained in:
Victor Farazdagi 2017-03-10 03:16:32 +03:00
parent 13efd3063d
commit 908f34939a
7 changed files with 73 additions and 53 deletions

View File

@ -274,6 +274,11 @@ func Call(chatId *C.char, path *C.char, params *C.char) *C.char {
return C.CString(res)
}
//export PopulateStaticPeers
func PopulateStaticPeers() {
geth.NodeManagerInstance().PopulateStaticPeers()
}
//export AddPeer
func AddPeer(url *C.char) *C.char {
success, err := geth.NodeManagerInstance().AddPeer(C.GoString(url))

View File

@ -3,7 +3,6 @@ package main
import "C"
import (
"encoding/json"
"io/ioutil"
"math/big"
"os"
"path/filepath"
@ -1231,18 +1230,7 @@ func startTestNode(t *testing.T) <-chan struct{} {
}
if envelope.Type == geth.EventNodeStarted {
// 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 {
AddPeer(C.CString(enode))
}
PopulateStaticPeers()
// sync
if syncRequired {

View File

@ -1,7 +0,0 @@
[
"enode://ebdf43b6fbca48141d08eef70e5735241445e7f2d2937dfd1cb808b598a94fb1e9834372b9f59b1f72e01a38d4102767cc40144f7f4ff17a9a6808b2202559e4@162.243.63.248:30303",
"enode://e19d89e6faf2772e2f250e9625478ee7f313fcc0bb5e9310d5d407371496d9d7d73ccecd9f226cc2a8be34484525f72ba9db9d26f0222f4efc3c6d9d995ee224@198.199.105.122:30303",
"enode://5f23bf4913dd005ce945648cb12d3ef970069818d8563a3fe054e5e1dc3898b9cb83e0af1f51b2dce75eaffc76e93f996caf538e21c5b64db5fa324958d59630@95.85.40.211:30303",
"enode://b9de2532421f15ac55da9d9a7cddc0dc08b0d646d631fd7ab2a170bd2163fb86b095dd8bde66b857592812f7cd9539f2919b6c64bc1a784a1d1c6ec8137681ed@188.166.229.119:30303",
"enode://1ad53266faaa9258ae71eef4d162022ba0d39498e1a3488e6c65fd86e0fb528e2aa68ad0e199da69fd39f4a3a38e9e8e95ac53ba5cc7676dfeaacf5fd6c0ad27@139.59.212.114:30303"
]

View File

@ -23,6 +23,7 @@ import (
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/discv5"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
whisper "github.com/ethereum/go-ethereum/whisper/whisperv2"
@ -30,14 +31,13 @@ import (
const (
ClientIdentifier = "StatusIM" // Client identifier to advertise over the network
VersionMajor = 1 // Major version component of the current release
VersionMinor = 2 // Minor version component of the current release
VersionPatch = 0 // Patch version component of the current release
VersionMajor = 0 // Major version component of the current release
VersionMinor = 9 // Minor version component of the current release
VersionPatch = 3 // Patch version component of the current release
VersionMeta = "unstable" // Version metadata to append to the version string
IPCFile = "geth.ipc" // Filename of exposed IPC-RPC Server
HTTPPort = 8545 // HTTP-RPC port (replaced in unit tests)
WSPort = 8546 // WS-RPC port (replaced in unit tests)
NetworkPort = 30303
MaxPeers = 25
MaxLightPeers = 20
MaxPendingPeers = 0
@ -103,6 +103,11 @@ func (n *Node) Inited() bool {
return n != nil && n.geth != nil
}
// GethStack returns reference to Geth stack
func (n *Node) GethStack() *node.Node {
return n.geth
}
// MakeNode create a geth node entity
func MakeNode(config *NodeConfig) *Node {
glog.CopyStandardLogTo("INFO")
@ -123,11 +128,12 @@ func MakeNode(config *NodeConfig) *Node {
Name: ClientIdentifier,
Version: fmt.Sprintf("%d.%d.%d-%s", VersionMajor, VersionMinor, VersionPatch, VersionMeta),
NoDiscovery: true,
DiscoveryV5: true,
DiscoveryV5Addr: fmt.Sprintf(":%d", NetworkPort+1),
DiscoveryV5: false,
DiscoveryV5Addr: ":0",
BootstrapNodes: makeBootstrapNodes(),
BootstrapNodesV5: makeBootstrapNodesV5(),
ListenAddr: fmt.Sprintf(":%d", NetworkPort),
ListenAddr: ":0",
NAT: nat.Any(),
MaxPeers: MaxPeers,
MaxPendingPeers: MaxPendingPeers,
IPCPath: makeIPCPath(dataDir, config.IPCEnabled),
@ -313,10 +319,9 @@ func makeDefaultExtra() []byte {
// makeBootstrapNodes returns default (hence bootstrap) list of peers
func makeBootstrapNodes() []*discover.Node {
enodes := params.MainnetBootnodes
if UseTestnet {
enodes = params.TestnetBootnodes
}
// on desktops params.TestnetBootnodes and params.MainBootnodes,
// on mobile client we deliberately keep this list empty
enodes := []string{}
var bootstapNodes []*discover.Node
for _, enode := range enodes {
@ -328,7 +333,9 @@ func makeBootstrapNodes() []*discover.Node {
// makeBootstrapNodesV5 returns default (hence bootstrap) list of peers
func makeBootstrapNodesV5() []*discv5.Node {
enodes := params.DiscoveryV5Bootnodes
// on desktops params.DiscoveryV5Bootnodes,
// on mobile client we deliberately keep this list empty
enodes := []string{}
var bootstapNodes []*discv5.Node
for _, enode := range enodes {

View File

@ -19,6 +19,7 @@ import (
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/rpc"
whisper "github.com/ethereum/go-ethereum/whisper/whisperv2"
"github.com/status-im/status-go/params"
)
// SelectedExtKey is a container for currently selected (logged in) account
@ -132,7 +133,7 @@ func (m *NodeManager) RunNode() {
// expose API
m.api = node.NewPrivateAdminAPI(m.node.geth)
m.populateStaticPeers()
m.PopulateStaticPeers()
m.onNodeStarted() // node started, notify listeners
m.node.geth.Wait()
@ -397,17 +398,9 @@ func (m *NodeManager) onNodeStarted() {
})
}
// populateStaticPeers connects current node with our publicly available LES cluster
func (m *NodeManager) populateStaticPeers() {
// manually add static nodes (LES auto-discovery is not stable yet)
enodes := []string{
"enode://ebdf43b6fbca48141d08eef70e5735241445e7f2d2937dfd1cb808b598a94fb1e9834372b9f59b1f72e01a38d4102767cc40144f7f4ff17a9a6808b2202559e4@162.243.63.248:30303",
"enode://e19d89e6faf2772e2f250e9625478ee7f313fcc0bb5e9310d5d407371496d9d7d73ccecd9f226cc2a8be34484525f72ba9db9d26f0222f4efc3c6d9d995ee224@198.199.105.122:30303",
"enode://5f23bf4913dd005ce945648cb12d3ef970069818d8563a3fe054e5e1dc3898b9cb83e0af1f51b2dce75eaffc76e93f996caf538e21c5b64db5fa324958d59630@95.85.40.211:30303",
"enode://b9de2532421f15ac55da9d9a7cddc0dc08b0d646d631fd7ab2a170bd2163fb86b095dd8bde66b857592812f7cd9539f2919b6c64bc1a784a1d1c6ec8137681ed@188.166.229.119:30303",
"enode://1ad53266faaa9258ae71eef4d162022ba0d39498e1a3488e6c65fd86e0fb528e2aa68ad0e199da69fd39f4a3a38e9e8e95ac53ba5cc7676dfeaacf5fd6c0ad27@139.59.212.114:30303",
}
for _, enode := range enodes {
// PopulateStaticPeers connects current node with our publicly available LES/SHH/Swarm cluster
func (m *NodeManager) PopulateStaticPeers() {
for _, enode := range params.TestnetBootnodes {
m.AddPeer(enode)
}
}

View File

@ -180,15 +180,6 @@ func PreprocessDataDir(dataDir string) (string, error) {
}
}
// copy over static peer nodes list (LES auto-discovery is not stable yet)
dst := filepath.Join(dataDir, "testnet", "static-nodes.json")
if _, err := os.Stat(dst); os.IsNotExist(err) {
src := filepath.Join("../data", "static-nodes.json")
if err := CopyFile(dst, src); err != nil {
return dataDir, err
}
}
return dataDir, nil
}

43
params/bootnodes.go Normal file
View File

@ -0,0 +1,43 @@
package params
// MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main Ethereum network.
var MainnetBootnodes = []string{
}
// TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the Ropsten test network.
var TestnetBootnodes = []string{
"enode://bc4a130219ae94c2a66e3ec3377c2a460e006d56b877d5e8edb0d0f8064cf400f117a53a5389f552c9e1a122b9a07eeaa41e7ed885268ee825b6a788188fb52e@51.15.55.219:30399",
"enode://fbddff478e18292dc32b90f139bf773a08da89ffe29208e4de0091f6c589e60fccfaf16d4f4a76be49f57782c061ec8ea97078601c6f367feabda740f5ce8246@51.15.55.219:30303",
"enode://df20352d07924ffe93e67ee7e81105d7b250f7932ff4e0351da2cfa17282e53f765895c32cda36b70dfb98def0b472b29d79321737035641bf3bcf595dcc1041@51.15.35.110:30399",
"enode://4e5ee0487a4d8349ab9a9925b00eed0f976d98972c5a22f43fd50d1424897757032c36f273b434a4d3e013a2544eca74a9d1a0419f9f07f7bb43182a73df3690@51.15.35.110:30303",
"enode://2cbcc7b3d067581072066143e0fade0d007e80ecc8f86eb475200c3da3a6d81dd4e1e7051fc3dfaee337f110ceec61594a901b09e36eb367629ddff6e1dfd955@51.15.34.3:30399",
"enode://18efd9afb60443e00fed602cc0df526cd1d8543d2f6037df9380eb973d30b5fd04ac9f221053f82034581051bfd6e54356a99af2255f1a674d71d17440a6c95b@51.15.34.3:30303",
"enode://cdb95f3d866472a74195342979ffea4ed7f9b68cd1e8c6f9a25b3197c221f01bc076ccba760341d8b69bb6bfbc9bf4fdeabd0caa99ee0bf4e79917fa1f42423c@51.15.56.154:30399",
"enode://5b99c0cb372299fd3f2d94612a682990722eb7c3a252dacefc8270eb7f172fc699c1ddfad826fbfc979270538e8d89bd6919703eb9ef526eac0a45e9fb455123@51.15.56.154:30303",
"enode://5ce8e96d9589671767a7b1c6b9a34bcf532587387eb062de712a9f716a66f05f412126121ce4d97330bc5dc7a4938ff1ecc22306b0b8b97a7f748c6f5f59c620@51.15.60.23:30399",
"enode://0e1d4d0fcfe888bf8a478b0fd89760a47733a5c04cd47de353295a6eb8dde8f54821b31196527d0c5c73a7024dc9ff34127692d237840fc09c312b3a19cd28fe@51.15.60.23:30303",
"enode://6853f434735e540f0fcd85ffebcaa75280d1171ca9a205e8c41d87428d71b07ad14ab266236b64268467ccc462679edc888f76326418d18d7bcfe8d1159391aa@51.15.61.194:30399",
"enode://1fa2dfe6b925ca753496ea197c973b66ef889ef4de2bf52acd5b8665c0cc2e8b95fbd192e764f10735f589297f1ae533f350f004e403063e8d4ad979aae44c12@51.15.61.194:30303",
"enode://a8f1dae49f665c566734e002f89c1feb9b01e3ed09bdea6199aa6093f25085c4777fd553d2d1d14457286c24aaa48eaf6db99315e0caf62d97ea8bce801ae7c1@51.15.35.2:30399",
"enode://44b91c043bcd96bc5279524f1bfe32df0670374135435ebacb29ba5d0e18192623e63ead711c9c363afdf2500fac423116ac28bdd2d700bd70e096326f95c63f@51.15.35.2:30303",
"enode://64278f1e4224a5ff4608da54b7b045ae0b875a332c57e6f9b4cbb3e9ac1e56a1d5b91ff2def2662c767146b3f7f08924c15f66d41352a18ebe71832c35f6a0cf@51.15.54.229:30399",
"enode://fb7622d3a50dc603f5c76919dd99c4112e5925cb891a67086b9dce581166fbdad361fd0bfb7ff128ab8f5e24e209e0b923668fbddb7e8b99edb82c1e3d782a80@51.15.54.229:30303",
"enode://e1fcf9e7a47ab43a546d1c1633c511d98d13646bbf5c82d74ff98a1c88e54567b0be6574e977164e1b4c997ef8e79b19f1e12e85a6230c746dd74206fe37cfa0@51.15.35.70:30399",
"enode://14c2960f57f6d63ed541cf64226aafbc7a21c40c6e4935a2e58fd2466fa7d06ec32082734c64d32f7c4692f4b90f26d019f472ba55cdda6d624ef4d7d8441285@51.15.35.70:30303",
"enode://a8512bcaae1245fda71d400291dd22937d89947b6fc31283945557abe1281c5a9325ffc11e363cfed6362e4d2d9b941c5b325270662ba43ac8c424168e6567a6@51.15.39.57:30399",
"enode://02cfa2b02b5431bfdc1bad0f575de8ea151029fe9a9c689074793d704d1b428255bd111bf578f0b4fcaa18267da7c335db9557e1012434f4a8ab2c25f4b3da4d@51.15.39.57:30303",
}
// DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the
// experimental RLPx v5 topic-discovery network.
var DiscoveryV5Bootnodes = []string{
}