mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Merge pull request #6 from orangeAndSuns/feature/url-node-format-BLC-37
Change url node format enode to essnode
This commit is contained in:
commit
02c4c86295
51 changed files with 183 additions and 183 deletions
|
|
@ -236,10 +236,10 @@ $ bootnode --genkey=boot.key
|
||||||
$ bootnode --nodekey=boot.key
|
$ bootnode --nodekey=boot.key
|
||||||
```
|
```
|
||||||
|
|
||||||
With the bootnode online, it will display an [`enode` URL](https://github.com/ethereum/wiki/wiki/enode-url-format)
|
With the bootnode online, it will display an [`essnode` URL](https://github.com/ethereum/wiki/wiki/essnode-url-format)
|
||||||
that other nodes can use to connect to it and exchange peer information. Make sure to replace the
|
that other nodes can use to connect to it and exchange peer information. Make sure to replace the
|
||||||
displayed IP address information (most probably `[::]`) with your externally accessible IP to get the
|
displayed IP address information (most probably `[::]`) with your externally accessible IP to get the
|
||||||
actual `enode` URL.
|
actual `essnode` URL.
|
||||||
|
|
||||||
*Note: You could also use a full fledged Geth node as a bootnode, but it's the less recommended way.*
|
*Note: You could also use a full fledged Geth node as a bootnode, but it's the less recommended way.*
|
||||||
|
|
||||||
|
|
@ -251,7 +251,7 @@ via the `--bootnodes` flag. It will probably also be desirable to keep the data
|
||||||
private network separated, so do also specify a custom `--datadir` flag.
|
private network separated, so do also specify a custom `--datadir` flag.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ geth --datadir=path/to/custom/data/folder --bootnodes=<bootnode-enode-url-from-above>
|
$ geth --datadir=path/to/custom/data/folder --bootnodes=<bootnode-essnode-url-from-above>
|
||||||
```
|
```
|
||||||
|
|
||||||
*Note: Since your network will be completely cut off from the main and test networks, you'll also
|
*Note: Since your network will be completely cut off from the main and test networks, you'll also
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ var (
|
||||||
genesisFlag = flag.String("genesis", "", "Genesis json file to seed the chain with")
|
genesisFlag = flag.String("genesis", "", "Genesis json file to seed the chain with")
|
||||||
apiPortFlag = flag.Int("apiport", 8080, "Listener port for the HTTP API connection")
|
apiPortFlag = flag.Int("apiport", 8080, "Listener port for the HTTP API connection")
|
||||||
ethPortFlag = flag.Int("ethport", 30303, "Listener port for the devp2p connection")
|
ethPortFlag = flag.Int("ethport", 30303, "Listener port for the devp2p connection")
|
||||||
bootFlag = flag.String("bootnodes", "", "Comma separated bootnode enode URLs to seed with")
|
bootFlag = flag.String("bootnodes", "", "Comma separated bootnode essnode URLs to seed with")
|
||||||
netFlag = flag.Uint64("network", 0, "Network ID to use for the Ethereum protocol")
|
netFlag = flag.Uint64("network", 0, "Network ID to use for the Ethereum protocol")
|
||||||
statsFlag = flag.String("ethstats", "", "Ethstats network monitoring auth string")
|
statsFlag = flag.String("ethstats", "", "Ethstats network monitoring auth string")
|
||||||
|
|
||||||
|
|
@ -144,11 +144,11 @@ func main() {
|
||||||
if err = json.Unmarshal(blob, genesis); err != nil {
|
if err = json.Unmarshal(blob, genesis); err != nil {
|
||||||
log.Crit("Failed to parse genesis block json", "err", err)
|
log.Crit("Failed to parse genesis block json", "err", err)
|
||||||
}
|
}
|
||||||
// Convert the bootnodes to internal enode representations
|
// Convert the bootnodes to internal essnode representations
|
||||||
var enodes []*discv5.Node
|
var essnodes []*discv5.Node
|
||||||
for _, boot := range strings.Split(*bootFlag, ",") {
|
for _, boot := range strings.Split(*bootFlag, ",") {
|
||||||
if url, err := discv5.ParseNode(boot); err == nil {
|
if url, err := discv5.ParseNode(boot); err == nil {
|
||||||
enodes = append(enodes, url)
|
essnodes = append(essnodes, url)
|
||||||
} else {
|
} else {
|
||||||
log.Error("Failed to parse bootnode URL", "url", boot, "err", err)
|
log.Error("Failed to parse bootnode URL", "url", boot, "err", err)
|
||||||
}
|
}
|
||||||
|
|
@ -170,7 +170,7 @@ func main() {
|
||||||
ks.Unlock(acc, pass)
|
ks.Unlock(acc, pass)
|
||||||
|
|
||||||
// Assemble and start the faucet light service
|
// Assemble and start the faucet light service
|
||||||
faucet, err := newFaucet(genesis, *ethPortFlag, enodes, *netFlag, *statsFlag, ks, website.Bytes())
|
faucet, err := newFaucet(genesis, *ethPortFlag, essnodes, *netFlag, *statsFlag, ks, website.Bytes())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Crit("Failed to start faucet", "err", err)
|
log.Crit("Failed to start faucet", "err", err)
|
||||||
}
|
}
|
||||||
|
|
@ -209,7 +209,7 @@ type faucet struct {
|
||||||
lock sync.RWMutex // Lock protecting the faucet's internals
|
lock sync.RWMutex // Lock protecting the faucet's internals
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network uint64, stats string, ks *keystore.KeyStore, index []byte) (*faucet, error) {
|
func newFaucet(genesis *core.Genesis, port int, essnodes []*discv5.Node, network uint64, stats string, ks *keystore.KeyStore, index []byte) (*faucet, error) {
|
||||||
// Assemble the raw devp2p protocol stack
|
// Assemble the raw devp2p protocol stack
|
||||||
stack, err := node.New(&node.Config{
|
stack, err := node.New(&node.Config{
|
||||||
Name: "geth",
|
Name: "geth",
|
||||||
|
|
@ -221,7 +221,7 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network u
|
||||||
DiscoveryV5: true,
|
DiscoveryV5: true,
|
||||||
ListenAddr: fmt.Sprintf(":%d", port),
|
ListenAddr: fmt.Sprintf(":%d", port),
|
||||||
MaxPeers: 25,
|
MaxPeers: 25,
|
||||||
BootstrapNodesV5: enodes,
|
BootstrapNodesV5: essnodes,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -251,7 +251,7 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network u
|
||||||
if err := stack.Start(); err != nil {
|
if err := stack.Start(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, boot := range enodes {
|
for _, boot := range essnodes {
|
||||||
old, _ := discover.ParseNode(boot.String())
|
old, _ := discover.ParseNode(boot.String())
|
||||||
stack.Server().AddPeer(old)
|
stack.Server().AddPeer(old)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ func showNode(ctx *cli.Context) error {
|
||||||
fmt.Fprintf(w, "NAME\t%s\n", node.Name)
|
fmt.Fprintf(w, "NAME\t%s\n", node.Name)
|
||||||
fmt.Fprintf(w, "PROTOCOLS\t%s\n", strings.Join(protocolList(node), ","))
|
fmt.Fprintf(w, "PROTOCOLS\t%s\n", strings.Join(protocolList(node), ","))
|
||||||
fmt.Fprintf(w, "ID\t%s\n", node.ID)
|
fmt.Fprintf(w, "ID\t%s\n", node.ID)
|
||||||
fmt.Fprintf(w, "ENODE\t%s\n", node.Enode)
|
fmt.Fprintf(w, "ESSNODE\t%s\n", node.ESSNode)
|
||||||
for name, proto := range node.Protocols {
|
for name, proto := range node.Protocols {
|
||||||
fmt.Fprintln(w)
|
fmt.Fprintln(w)
|
||||||
fmt.Fprintf(w, "--- PROTOCOL INFO: %s\n", name)
|
fmt.Fprintf(w, "--- PROTOCOL INFO: %s\n", name)
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ var dashboardContent = `
|
||||||
<pre>import org.ethereum.geth.*;</pre>
|
<pre>import org.ethereum.geth.*;</pre>
|
||||||
<pre>
|
<pre>
|
||||||
Enodes bootnodes = new Enodes();{{range .Bootnodes}}
|
Enodes bootnodes = new Enodes();{{range .Bootnodes}}
|
||||||
bootnodes.append(new Enode("{{.}}"));{{end}}
|
bootnodes.append(new ESSNode("{{.}}"));{{end}}
|
||||||
|
|
||||||
NodeConfig config = new NodeConfig();
|
NodeConfig config = new NodeConfig();
|
||||||
config.setBootstrapNodes(bootnodes);
|
config.setBootstrapNodes(bootnodes);
|
||||||
|
|
@ -597,7 +597,7 @@ func deployDashboard(client *sshClient, network string, conf *config, config *da
|
||||||
indexfile := new(bytes.Buffer)
|
indexfile := new(bytes.Buffer)
|
||||||
bootCpp := make([]string, len(conf.bootnodes))
|
bootCpp := make([]string, len(conf.bootnodes))
|
||||||
for i, boot := range conf.bootnodes {
|
for i, boot := range conf.bootnodes {
|
||||||
bootCpp[i] = "required:" + strings.TrimPrefix(boot, "enode://")
|
bootCpp[i] = "required:" + strings.TrimPrefix(boot, "essnode://")
|
||||||
}
|
}
|
||||||
bootHarmony := make([]string, len(conf.bootnodes))
|
bootHarmony := make([]string, len(conf.bootnodes))
|
||||||
for i, boot := range conf.bootnodes {
|
for i, boot := range conf.bootnodes {
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ type nodeInfos struct {
|
||||||
ethashdir string
|
ethashdir string
|
||||||
ethstats string
|
ethstats string
|
||||||
port int
|
port int
|
||||||
enode string
|
essnode string
|
||||||
peersTotal int
|
peersTotal int
|
||||||
peersLight int
|
peersLight int
|
||||||
etherbase string
|
etherbase string
|
||||||
|
|
@ -258,7 +258,7 @@ func checkNode(client *sshClient, network string, boot bool) (*nodeInfos, error)
|
||||||
gasTarget: gasTarget,
|
gasTarget: gasTarget,
|
||||||
gasPrice: gasPrice,
|
gasPrice: gasPrice,
|
||||||
}
|
}
|
||||||
stats.enode = fmt.Sprintf("enode://%s@%s:%d", id, client.address, stats.port)
|
stats.essnode = fmt.Sprintf("essnode://%s@%s:%d", id, client.address, stats.port)
|
||||||
|
|
||||||
return stats, nil
|
return stats, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ func (w *wizard) gatherStats(server string, pubkey []byte, client *sshClient) *s
|
||||||
stat.services["bootnode"] = infos.Report()
|
stat.services["bootnode"] = infos.Report()
|
||||||
|
|
||||||
genesis = string(infos.genesis)
|
genesis = string(infos.genesis)
|
||||||
bootnodes = append(bootnodes, infos.enode)
|
bootnodes = append(bootnodes, infos.essnode)
|
||||||
}
|
}
|
||||||
logger.Debug("Checking for sealnode availability")
|
logger.Debug("Checking for sealnode availability")
|
||||||
if infos, err := checkNode(client, w.network, false); err != nil {
|
if infos, err := checkNode(client, w.network, false); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -69,11 +69,11 @@ OPTIONS:
|
||||||
var (
|
var (
|
||||||
gitCommit string // Git SHA1 commit hash of the release (set via linker flags)
|
gitCommit string // Git SHA1 commit hash of the release (set via linker flags)
|
||||||
testbetBootNodes = []string{
|
testbetBootNodes = []string{
|
||||||
"enode://ec8ae764f7cb0417bdfb009b9d0f18ab3818a3a4e8e7c67dd5f18971a93510a2e6f43cd0b69a27e439a9629457ea804104f37c85e41eed057d3faabbf7744cdf@13.74.157.139:30429",
|
"essnode://ec8ae764f7cb0417bdfb009b9d0f18ab3818a3a4e8e7c67dd5f18971a93510a2e6f43cd0b69a27e439a9629457ea804104f37c85e41eed057d3faabbf7744cdf@13.74.157.139:30429",
|
||||||
"enode://c2e1fceb3bf3be19dff71eec6cccf19f2dbf7567ee017d130240c670be8594bc9163353ca55dd8df7a4f161dd94b36d0615c17418b5a3cdcbb4e9d99dfa4de37@13.74.157.139:30430",
|
"essnode://c2e1fceb3bf3be19dff71eec6cccf19f2dbf7567ee017d130240c670be8594bc9163353ca55dd8df7a4f161dd94b36d0615c17418b5a3cdcbb4e9d99dfa4de37@13.74.157.139:30430",
|
||||||
"enode://fe29b82319b734ce1ec68b84657d57145fee237387e63273989d354486731e59f78858e452ef800a020559da22dcca759536e6aa5517c53930d29ce0b1029286@13.74.157.139:30431",
|
"essnode://fe29b82319b734ce1ec68b84657d57145fee237387e63273989d354486731e59f78858e452ef800a020559da22dcca759536e6aa5517c53930d29ce0b1029286@13.74.157.139:30431",
|
||||||
"enode://1d7187e7bde45cf0bee489ce9852dd6d1a0d9aa67a33a6b8e6db8a4fbc6fcfa6f0f1a5419343671521b863b187d1c73bad3603bae66421d157ffef357669ddb8@13.74.157.139:30432",
|
"essnode://1d7187e7bde45cf0bee489ce9852dd6d1a0d9aa67a33a6b8e6db8a4fbc6fcfa6f0f1a5419343671521b863b187d1c73bad3603bae66421d157ffef357669ddb8@13.74.157.139:30432",
|
||||||
"enode://0e4cba800f7b1ee73673afa6a4acead4018f0149d2e3216be3f133318fd165b324cd71b81fbe1e80deac8dbf56e57a49db7be67f8b9bc81bd2b7ee496434fb5d@13.74.157.139:30433",
|
"essnode://0e4cba800f7b1ee73673afa6a4acead4018f0149d2e3216be3f133318fd165b324cd71b81fbe1e80deac8dbf56e57a49db7be67f8b9bc81bd2b7ee496434fb5d@13.74.157.139:30433",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ func newTestCluster(t *testing.T, size int) *testCluster {
|
||||||
|
|
||||||
// connect the nodes together
|
// connect the nodes together
|
||||||
for _, node := range cluster.Nodes {
|
for _, node := range cluster.Nodes {
|
||||||
if err := node.Client.Call(nil, "admin_addPeer", cluster.Nodes[0].Enode); err != nil {
|
if err := node.Client.Call(nil, "admin_addPeer", cluster.Nodes[0].ESSNode); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -175,7 +175,7 @@ type testNode struct {
|
||||||
Name string
|
Name string
|
||||||
Addr string
|
Addr string
|
||||||
URL string
|
URL string
|
||||||
Enode string
|
ESSNode string
|
||||||
Dir string
|
Dir string
|
||||||
IpcPath string
|
IpcPath string
|
||||||
Client *rpc.Client
|
Client *rpc.Client
|
||||||
|
|
@ -269,7 +269,7 @@ func existingTestNode(t *testing.T, dir string, bzzaccount string) *testNode {
|
||||||
if err := node.Client.Call(&nodeInfo, "admin_nodeInfo"); err != nil {
|
if err := node.Client.Call(&nodeInfo, "admin_nodeInfo"); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
node.Enode = fmt.Sprintf("enode://%s@127.0.0.1:%s", nodeInfo.ID, p2pPort)
|
node.ESSNode = fmt.Sprintf("essnode://%s@127.0.0.1:%s", nodeInfo.ID, p2pPort)
|
||||||
|
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
@ -331,7 +331,7 @@ func newTestNode(t *testing.T, dir string) *testNode {
|
||||||
if err := node.Client.Call(&nodeInfo, "admin_nodeInfo"); err != nil {
|
if err := node.Client.Call(&nodeInfo, "admin_nodeInfo"); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
node.Enode = fmt.Sprintf("enode://%s@127.0.0.1:%s", nodeInfo.ID, p2pPort)
|
node.ESSNode = fmt.Sprintf("essnode://%s@127.0.0.1:%s", nodeInfo.ID, p2pPort)
|
||||||
node.IpcPath = conf.IPCPath
|
node.IpcPath = conf.IPCPath
|
||||||
|
|
||||||
return node
|
return node
|
||||||
|
|
|
||||||
|
|
@ -459,17 +459,17 @@ var (
|
||||||
}
|
}
|
||||||
BootnodesFlag = cli.StringFlag{
|
BootnodesFlag = cli.StringFlag{
|
||||||
Name: "bootnodes",
|
Name: "bootnodes",
|
||||||
Usage: "Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers)",
|
Usage: "Comma separated essnode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers)",
|
||||||
Value: "",
|
Value: "",
|
||||||
}
|
}
|
||||||
BootnodesV4Flag = cli.StringFlag{
|
BootnodesV4Flag = cli.StringFlag{
|
||||||
Name: "bootnodesv4",
|
Name: "bootnodesv4",
|
||||||
Usage: "Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes)",
|
Usage: "Comma separated essnode URLs for P2P v4 discovery bootstrap (light server, full nodes)",
|
||||||
Value: "",
|
Value: "",
|
||||||
}
|
}
|
||||||
BootnodesV5Flag = cli.StringFlag{
|
BootnodesV5Flag = cli.StringFlag{
|
||||||
Name: "bootnodesv5",
|
Name: "bootnodesv5",
|
||||||
Usage: "Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes)",
|
Usage: "Comma separated essnode URLs for P2P v5 discovery bootstrap (light server, light nodes)",
|
||||||
Value: "",
|
Value: "",
|
||||||
}
|
}
|
||||||
NodeKeyFileFlag = cli.StringFlag{
|
NodeKeyFileFlag = cli.StringFlag{
|
||||||
|
|
@ -644,7 +644,7 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
for _, url := range urls {
|
for _, url := range urls {
|
||||||
node, err := discover.ParseNode(url)
|
node, err := discover.ParseNode(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Bootstrap URL invalid", "enode", url, "err", err)
|
log.Error("Bootstrap URL invalid", "essnode", url, "err", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
cfg.BootstrapNodes = append(cfg.BootstrapNodes, node)
|
cfg.BootstrapNodes = append(cfg.BootstrapNodes, node)
|
||||||
|
|
@ -672,7 +672,7 @@ func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
for _, url := range urls {
|
for _, url := range urls {
|
||||||
node, err := discv5.ParseNode(url)
|
node, err := discv5.ParseNode(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Bootstrap URL invalid", "enode", url, "err", err)
|
log.Error("Bootstrap URL invalid", "essnode", url, "err", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
cfg.BootstrapNodesV5 = append(cfg.BootstrapNodesV5, node)
|
cfg.BootstrapNodesV5 = append(cfg.BootstrapNodesV5, node)
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ var (
|
||||||
argPub = flag.String("pub", "", "public key for asymmetric encryption")
|
argPub = flag.String("pub", "", "public key for asymmetric encryption")
|
||||||
argDBPath = flag.String("dbpath", "", "path to the server's DB directory")
|
argDBPath = flag.String("dbpath", "", "path to the server's DB directory")
|
||||||
argIDFile = flag.String("idfile", "", "file name with node id (private key)")
|
argIDFile = flag.String("idfile", "", "file name with node id (private key)")
|
||||||
argEnode = flag.String("boot", "", "bootstrap node you want to connect to (e.g. enode://e454......08d50@52.176.211.200:16428)")
|
argEnode = flag.String("boot", "", "bootstrap node you want to connect to (e.g. essnode://e454......08d50@52.176.211.200:16428)")
|
||||||
argTopic = flag.String("topic", "", "topic in hexadecimal format (e.g. 70a4beef)")
|
argTopic = flag.String("topic", "", "topic in hexadecimal format (e.g. 70a4beef)")
|
||||||
argSaveDir = flag.String("savedir", "", "directory where all incoming messages will be saved as files")
|
argSaveDir = flag.String("savedir", "", "directory where all incoming messages will be saved as files")
|
||||||
)
|
)
|
||||||
|
|
@ -124,10 +124,10 @@ func processArgs() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const enodePrefix = "enode://"
|
const essnodePrefix = "essnode://"
|
||||||
if len(*argEnode) > 0 {
|
if len(*argEnode) > 0 {
|
||||||
if (*argEnode)[:len(enodePrefix)] != enodePrefix {
|
if (*argEnode)[:len(essnodePrefix)] != essnodePrefix {
|
||||||
*argEnode = enodePrefix + *argEnode
|
*argEnode = essnodePrefix + *argEnode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,7 +201,7 @@ func initialize() {
|
||||||
*bootstrapMode = true
|
*bootstrapMode = true
|
||||||
} else {
|
} else {
|
||||||
if len(*argEnode) == 0 {
|
if len(*argEnode) == 0 {
|
||||||
argEnode = scanLineA("Please enter the peer's enode: ")
|
argEnode = scanLineA("Please enter the peer's essnode: ")
|
||||||
}
|
}
|
||||||
peer := discover.MustParseNode(*argEnode)
|
peer := discover.MustParseNode(*argEnode)
|
||||||
peers = append(peers, peer)
|
peers = append(peers, peer)
|
||||||
|
|
@ -299,7 +299,7 @@ func startServer() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("my public key: %s \n", common.ToHex(crypto.FromECDSAPub(&asymKey.PublicKey)))
|
fmt.Printf("my public key: %s \n", common.ToHex(crypto.FromECDSAPub(&asymKey.PublicKey)))
|
||||||
fmt.Println(server.NodeInfo().Enode)
|
fmt.Println(server.NodeInfo().ESSNode)
|
||||||
|
|
||||||
if *bootstrapMode {
|
if *bootstrapMode {
|
||||||
configureNode()
|
configureNode()
|
||||||
|
|
@ -749,7 +749,7 @@ func requestExpiredMessagesLoop() {
|
||||||
func extractIDFromEnode(s string) []byte {
|
func extractIDFromEnode(s string) []byte {
|
||||||
n, err := discover.ParseNode(s)
|
n, err := discover.ParseNode(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Fatalf("Failed to parse enode: %s", err)
|
utils.Fatalf("Failed to parse essnode: %s", err)
|
||||||
}
|
}
|
||||||
return n.ID[:]
|
return n.ID[:]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ func (pool *serverPool) start(server *p2p.Server, topic discv5.Topic) {
|
||||||
// Note that whenever a connection has been accepted and a pool entry has been returned,
|
// Note that whenever a connection has been accepted and a pool entry has been returned,
|
||||||
// disconnect should also always be called.
|
// disconnect should also always be called.
|
||||||
func (pool *serverPool) connect(p *peer, ip net.IP, port uint16) *poolEntry {
|
func (pool *serverPool) connect(p *peer, ip net.IP, port uint16) *poolEntry {
|
||||||
log.Debug("Connect new entry", "enode", p.id)
|
log.Debug("Connect new entry", "essnode", p.id)
|
||||||
req := &connReq{p: p, ip: ip, port: port, result: make(chan *poolEntry, 1)}
|
req := &connReq{p: p, ip: ip, port: port, result: make(chan *poolEntry, 1)}
|
||||||
select {
|
select {
|
||||||
case pool.connCh <- req:
|
case pool.connCh <- req:
|
||||||
|
|
@ -196,7 +196,7 @@ func (pool *serverPool) connect(p *peer, ip net.IP, port uint16) *poolEntry {
|
||||||
|
|
||||||
// registered should be called after a successful handshake
|
// registered should be called after a successful handshake
|
||||||
func (pool *serverPool) registered(entry *poolEntry) {
|
func (pool *serverPool) registered(entry *poolEntry) {
|
||||||
log.Debug("Registered new entry", "enode", entry.id)
|
log.Debug("Registered new entry", "essnode", entry.id)
|
||||||
req := ®isterReq{entry: entry, done: make(chan struct{})}
|
req := ®isterReq{entry: entry, done: make(chan struct{})}
|
||||||
select {
|
select {
|
||||||
case pool.registerCh <- req:
|
case pool.registerCh <- req:
|
||||||
|
|
@ -216,7 +216,7 @@ func (pool *serverPool) disconnect(entry *poolEntry) {
|
||||||
stopped = true
|
stopped = true
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
log.Debug("Disconnected old entry", "enode", entry.id)
|
log.Debug("Disconnected old entry", "essnode", entry.id)
|
||||||
req := &disconnReq{entry: entry, stopped: stopped, done: make(chan struct{})}
|
req := &disconnReq{entry: entry, stopped: stopped, done: make(chan struct{})}
|
||||||
|
|
||||||
// Block until disconnection request is served.
|
// Block until disconnection request is served.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Contains all the wrappers from the accounts package to support client side enode
|
// Contains all the wrappers from the accounts package to support client side essnode
|
||||||
// management on mobile platforms.
|
// management on mobile platforms.
|
||||||
|
|
||||||
package geth
|
package geth
|
||||||
|
|
@ -25,8 +25,8 @@ import (
|
||||||
"github.com/orangeAndSuns/go-ethereum/p2p/discv5"
|
"github.com/orangeAndSuns/go-ethereum/p2p/discv5"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enode represents a host on the network.
|
// ESSNode represents a host on the network.
|
||||||
type Enode struct {
|
type ESSNode struct {
|
||||||
node *discv5.Node
|
node *discv5.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ type Enode struct {
|
||||||
//
|
//
|
||||||
// For incomplete nodes, the designator must look like one of these
|
// For incomplete nodes, the designator must look like one of these
|
||||||
//
|
//
|
||||||
// enode://<hex node id>
|
// essnode://<hex node id>
|
||||||
// <hex node id>
|
// <hex node id>
|
||||||
//
|
//
|
||||||
// For complete nodes, the node ID is encoded in the username portion
|
// For complete nodes, the node ID is encoded in the username portion
|
||||||
|
|
@ -52,53 +52,53 @@ type Enode struct {
|
||||||
// a node with IP address 10.3.58.6, TCP listening port 30303
|
// a node with IP address 10.3.58.6, TCP listening port 30303
|
||||||
// and UDP discovery port 30301.
|
// and UDP discovery port 30301.
|
||||||
//
|
//
|
||||||
// enode://<hex node id>@10.3.58.6:30303?discport=30301
|
// essnode://<hex node id>@10.3.58.6:30303?discport=30301
|
||||||
func NewEnode(rawurl string) (enode *Enode, _ error) {
|
func NewEnode(rawurl string) (essnode *ESSNode, _ error) {
|
||||||
node, err := discv5.ParseNode(rawurl)
|
node, err := discv5.ParseNode(rawurl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &Enode{node}, nil
|
return &ESSNode{node}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enodes represents a slice of accounts.
|
// Enodes represents a slice of accounts.
|
||||||
type Enodes struct{ nodes []*discv5.Node }
|
type Enodes struct{ nodes []*discv5.Node }
|
||||||
|
|
||||||
// NewEnodes creates a slice of uninitialized enodes.
|
// NewEnodes creates a slice of uninitialized essnodes.
|
||||||
func NewEnodes(size int) *Enodes {
|
func NewEnodes(size int) *Enodes {
|
||||||
return &Enodes{
|
return &Enodes{
|
||||||
nodes: make([]*discv5.Node, size),
|
nodes: make([]*discv5.Node, size),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEnodesEmpty creates an empty slice of Enode values.
|
// NewEnodesEmpty creates an empty slice of ESSNode values.
|
||||||
func NewEnodesEmpty() *Enodes {
|
func NewEnodesEmpty() *Enodes {
|
||||||
return NewEnodes(0)
|
return NewEnodes(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size returns the number of enodes in the slice.
|
// Size returns the number of essnodes in the slice.
|
||||||
func (e *Enodes) Size() int {
|
func (e *Enodes) Size() int {
|
||||||
return len(e.nodes)
|
return len(e.nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the enode at the given index from the slice.
|
// Get returns the essnode at the given index from the slice.
|
||||||
func (e *Enodes) Get(index int) (enode *Enode, _ error) {
|
func (e *Enodes) Get(index int) (essnode *ESSNode, _ error) {
|
||||||
if index < 0 || index >= len(e.nodes) {
|
if index < 0 || index >= len(e.nodes) {
|
||||||
return nil, errors.New("index out of bounds")
|
return nil, errors.New("index out of bounds")
|
||||||
}
|
}
|
||||||
return &Enode{e.nodes[index]}, nil
|
return &ESSNode{e.nodes[index]}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set sets the enode at the given index in the slice.
|
// Set sets the essnode at the given index in the slice.
|
||||||
func (e *Enodes) Set(index int, enode *Enode) error {
|
func (e *Enodes) Set(index int, essnode *ESSNode) error {
|
||||||
if index < 0 || index >= len(e.nodes) {
|
if index < 0 || index >= len(e.nodes) {
|
||||||
return errors.New("index out of bounds")
|
return errors.New("index out of bounds")
|
||||||
}
|
}
|
||||||
e.nodes[index] = enode.node
|
e.nodes[index] = essnode.node
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append adds a new enode element to the end of the slice.
|
// Append adds a new essnode element to the end of the slice.
|
||||||
func (e *Enodes) Append(enode *Enode) {
|
func (e *Enodes) Append(essnode *ESSNode) {
|
||||||
e.nodes = append(e.nodes, enode.node)
|
e.nodes = append(e.nodes, essnode.node)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ type NodeInfo struct {
|
||||||
|
|
||||||
func (ni *NodeInfo) GetID() string { return ni.info.ID }
|
func (ni *NodeInfo) GetID() string { return ni.info.ID }
|
||||||
func (ni *NodeInfo) GetName() string { return ni.info.Name }
|
func (ni *NodeInfo) GetName() string { return ni.info.Name }
|
||||||
func (ni *NodeInfo) GetEnode() string { return ni.info.Enode }
|
func (ni *NodeInfo) GetEnode() string { return ni.info.ESSNode }
|
||||||
func (ni *NodeInfo) GetIP() string { return ni.info.IP }
|
func (ni *NodeInfo) GetIP() string { return ni.info.IP }
|
||||||
func (ni *NodeInfo) GetDiscoveryPort() int { return ni.info.Ports.Discovery }
|
func (ni *NodeInfo) GetDiscoveryPort() int { return ni.info.Ports.Discovery }
|
||||||
func (ni *NodeInfo) GetListenerPort() int { return ni.info.Ports.Listener }
|
func (ni *NodeInfo) GetListenerPort() int { return ni.info.Ports.Listener }
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ func RinkebyGenesis() string {
|
||||||
return string(enc)
|
return string(enc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FoundationBootnodes returns the enode URLs of the P2P bootstrap nodes operated
|
// FoundationBootnodes returns the essnode URLs of the P2P bootstrap nodes operated
|
||||||
// by the foundation running the V5 discovery protocol.
|
// by the foundation running the V5 discovery protocol.
|
||||||
func FoundationBootnodes() *Enodes {
|
func FoundationBootnodes() *Enodes {
|
||||||
nodes := &Enodes{nodes: make([]*discv5.Node, len(params.DiscoveryV5Bootnodes))}
|
nodes := &Enodes{nodes: make([]*discv5.Node, len(params.DiscoveryV5Bootnodes))}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ func (api *PrivateAdminAPI) AddPeer(url string) (bool, error) {
|
||||||
// Try to add the url as a static peer and return
|
// Try to add the url as a static peer and return
|
||||||
node, err := discover.ParseNode(url)
|
node, err := discover.ParseNode(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, fmt.Errorf("invalid enode: %v", err)
|
return false, fmt.Errorf("invalid essnode: %v", err)
|
||||||
}
|
}
|
||||||
server.AddPeer(node)
|
server.AddPeer(node)
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
@ -69,7 +69,7 @@ func (api *PrivateAdminAPI) RemovePeer(url string) (bool, error) {
|
||||||
// Try to remove the url as a static peer and return
|
// Try to remove the url as a static peer and return
|
||||||
node, err := discover.ParseNode(url)
|
node, err := discover.ParseNode(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, fmt.Errorf("invalid enode: %v", err)
|
return false, fmt.Errorf("invalid essnode: %v", err)
|
||||||
}
|
}
|
||||||
server.RemovePeer(node)
|
server.RemovePeer(node)
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
|
||||||
|
|
@ -330,12 +330,12 @@ func (c *Config) NodeKey() *ecdsa.PrivateKey {
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
|
||||||
// StaticNodes returns a list of node enode URLs configured as static nodes.
|
// StaticNodes returns a list of node essnode URLs configured as static nodes.
|
||||||
func (c *Config) StaticNodes() []*discover.Node {
|
func (c *Config) StaticNodes() []*discover.Node {
|
||||||
return c.parsePersistentNodes(c.ResolvePath(datadirStaticNodes))
|
return c.parsePersistentNodes(c.ResolvePath(datadirStaticNodes))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TrustedNodes returns a list of node enode URLs configured as trusted nodes.
|
// TrustedNodes returns a list of node essnode URLs configured as trusted nodes.
|
||||||
func (c *Config) TrustedNodes() []*discover.Node {
|
func (c *Config) TrustedNodes() []*discover.Node {
|
||||||
return c.parsePersistentNodes(c.ResolvePath(datadirTrustedNodes))
|
return c.parsePersistentNodes(c.ResolvePath(datadirTrustedNodes))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ func (n *Node) validateComplete() error {
|
||||||
// The string representation of a Node is a URL.
|
// The string representation of a Node is a URL.
|
||||||
// Please see ParseNode for a description of the format.
|
// Please see ParseNode for a description of the format.
|
||||||
func (n *Node) String() string {
|
func (n *Node) String() string {
|
||||||
u := url.URL{Scheme: "enode"}
|
u := url.URL{Scheme: "essnode"}
|
||||||
if n.Incomplete() {
|
if n.Incomplete() {
|
||||||
u.Host = fmt.Sprintf("%x", n.ID[:])
|
u.Host = fmt.Sprintf("%x", n.ID[:])
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -115,7 +115,7 @@ func (n *Node) String() string {
|
||||||
return u.String()
|
return u.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
var incompleteNodeURL = regexp.MustCompile("(?i)^(?:enode://)?([0-9a-f]+)$")
|
var incompleteNodeURL = regexp.MustCompile("(?i)^(?:essnode://)?([0-9a-f]+)$")
|
||||||
|
|
||||||
// ParseNode parses a node designator.
|
// ParseNode parses a node designator.
|
||||||
//
|
//
|
||||||
|
|
@ -125,7 +125,7 @@ var incompleteNodeURL = regexp.MustCompile("(?i)^(?:enode://)?([0-9a-f]+)$")
|
||||||
//
|
//
|
||||||
// For incomplete nodes, the designator must look like one of these
|
// For incomplete nodes, the designator must look like one of these
|
||||||
//
|
//
|
||||||
// enode://<hex node id>
|
// essnode://<hex node id>
|
||||||
// <hex node id>
|
// <hex node id>
|
||||||
//
|
//
|
||||||
// For complete nodes, the node ID is encoded in the username portion
|
// For complete nodes, the node ID is encoded in the username portion
|
||||||
|
|
@ -139,7 +139,7 @@ var incompleteNodeURL = regexp.MustCompile("(?i)^(?:enode://)?([0-9a-f]+)$")
|
||||||
// a node with IP address 10.3.58.6, TCP listening port 30303
|
// a node with IP address 10.3.58.6, TCP listening port 30303
|
||||||
// and UDP discovery port 30301.
|
// and UDP discovery port 30301.
|
||||||
//
|
//
|
||||||
// enode://<hex node id>@10.3.58.6:30303?discport=30301
|
// essnode://<hex node id>@10.3.58.6:30303?discport=30301
|
||||||
func ParseNode(rawurl string) (*Node, error) {
|
func ParseNode(rawurl string) (*Node, error) {
|
||||||
if m := incompleteNodeURL.FindStringSubmatch(rawurl); m != nil {
|
if m := incompleteNodeURL.FindStringSubmatch(rawurl); m != nil {
|
||||||
id, err := HexID(m[1])
|
id, err := HexID(m[1])
|
||||||
|
|
@ -161,8 +161,8 @@ func parseComplete(rawurl string) (*Node, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if u.Scheme != "enode" {
|
if u.Scheme != "essnode" {
|
||||||
return nil, errors.New("invalid URL scheme, want \"enode\"")
|
return nil, errors.New("invalid URL scheme, want \"essnode\"")
|
||||||
}
|
}
|
||||||
// Parse the Node ID from the user portion.
|
// Parse the Node ID from the user portion.
|
||||||
if u.User == nil {
|
if u.User == nil {
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,9 @@ func ExampleNewNode() {
|
||||||
fmt.Println("n2.Incomplete() ->", n2.Incomplete())
|
fmt.Println("n2.Incomplete() ->", n2.Incomplete())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// n1: enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[2001:db8:3c4d:15::abcd:ef12]:30303?discport=52150
|
// n1: essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[2001:db8:3c4d:15::abcd:ef12]:30303?discport=52150
|
||||||
// n1.Incomplete() -> false
|
// n1.Incomplete() -> false
|
||||||
// n2: enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439
|
// n2: essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439
|
||||||
// n2.Incomplete() -> true
|
// n2.Incomplete() -> true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,27 +60,27 @@ var parseNodeTests = []struct {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
rawurl: "http://foobar",
|
rawurl: "http://foobar",
|
||||||
wantError: `invalid URL scheme, want "enode"`,
|
wantError: `invalid URL scheme, want "essnode"`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://01010101@123.124.125.126:3",
|
rawurl: "essnode://01010101@123.124.125.126:3",
|
||||||
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
||||||
},
|
},
|
||||||
// Complete nodes with IP address.
|
// Complete nodes with IP address.
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@hostname:3",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@hostname:3",
|
||||||
wantError: `invalid IP address`,
|
wantError: `invalid IP address`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:foo",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:foo",
|
||||||
wantError: `invalid port`,
|
wantError: `invalid port`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:3?discport=foo",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:3?discport=foo",
|
||||||
wantError: `invalid discport in query`,
|
wantError: `invalid discport in query`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:52150",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:52150",
|
||||||
wantResult: NewNode(
|
wantResult: NewNode(
|
||||||
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
||||||
net.IP{0x7f, 0x0, 0x0, 0x1},
|
net.IP{0x7f, 0x0, 0x0, 0x1},
|
||||||
|
|
@ -89,7 +89,7 @@ var parseNodeTests = []struct {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[::]:52150",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[::]:52150",
|
||||||
wantResult: NewNode(
|
wantResult: NewNode(
|
||||||
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
||||||
net.ParseIP("::"),
|
net.ParseIP("::"),
|
||||||
|
|
@ -98,7 +98,7 @@ var parseNodeTests = []struct {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[2001:db8:3c4d:15::abcd:ef12]:52150",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[2001:db8:3c4d:15::abcd:ef12]:52150",
|
||||||
wantResult: NewNode(
|
wantResult: NewNode(
|
||||||
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
||||||
net.ParseIP("2001:db8:3c4d:15::abcd:ef12"),
|
net.ParseIP("2001:db8:3c4d:15::abcd:ef12"),
|
||||||
|
|
@ -107,7 +107,7 @@ var parseNodeTests = []struct {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:52150?discport=22334",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:52150?discport=22334",
|
||||||
wantResult: NewNode(
|
wantResult: NewNode(
|
||||||
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
||||||
net.IP{0x7f, 0x0, 0x0, 0x1},
|
net.IP{0x7f, 0x0, 0x0, 0x1},
|
||||||
|
|
@ -124,7 +124,7 @@ var parseNodeTests = []struct {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439",
|
||||||
wantResult: NewNode(
|
wantResult: NewNode(
|
||||||
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
||||||
nil, 0, 0,
|
nil, 0, 0,
|
||||||
|
|
@ -136,7 +136,7 @@ var parseNodeTests = []struct {
|
||||||
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://01010101",
|
rawurl: "essnode://01010101",
|
||||||
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -171,7 +171,7 @@ func TestParseNode(t *testing.T) {
|
||||||
|
|
||||||
func TestNodeString(t *testing.T) {
|
func TestNodeString(t *testing.T) {
|
||||||
for i, test := range parseNodeTests {
|
for i, test := range parseNodeTests {
|
||||||
if test.wantError == "" && strings.HasPrefix(test.rawurl, "enode://") {
|
if test.wantError == "" && strings.HasPrefix(test.rawurl, "essnode://") {
|
||||||
str := test.wantResult.String()
|
str := test.wantResult.String()
|
||||||
if str != test.rawurl {
|
if str != test.rawurl {
|
||||||
t.Errorf("test %d: Node.String() mismatch:\ngot: %s\nwant: %s", i, str, test.rawurl)
|
t.Errorf("test %d: Node.String() mismatch:\ngot: %s\nwant: %s", i, str, test.rawurl)
|
||||||
|
|
|
||||||
|
|
@ -297,10 +297,10 @@ func TestUDP_findnodeMultiReply(t *testing.T) {
|
||||||
|
|
||||||
// send the reply as two packets.
|
// send the reply as two packets.
|
||||||
list := []*Node{
|
list := []*Node{
|
||||||
MustParseNode("enode://ba85011c70bcc5c04d8607d3a0ed29aa6179c092cbdda10d5d32684fb33ed01bd94f588ca8f91ac48318087dcb02eaf36773a7a453f0eedd6742af668097b29c@10.0.1.16:30303?discport=30304"),
|
MustParseNode("essnode://ba85011c70bcc5c04d8607d3a0ed29aa6179c092cbdda10d5d32684fb33ed01bd94f588ca8f91ac48318087dcb02eaf36773a7a453f0eedd6742af668097b29c@10.0.1.16:30303?discport=30304"),
|
||||||
MustParseNode("enode://81fa361d25f157cd421c60dcc28d8dac5ef6a89476633339c5df30287474520caca09627da18543d9079b5b288698b542d56167aa5c09111e55acdbbdf2ef799@10.0.1.16:30303"),
|
MustParseNode("essnode://81fa361d25f157cd421c60dcc28d8dac5ef6a89476633339c5df30287474520caca09627da18543d9079b5b288698b542d56167aa5c09111e55acdbbdf2ef799@10.0.1.16:30303"),
|
||||||
MustParseNode("enode://9bffefd833d53fac8e652415f4973bee289e8b1a5c6c4cbe70abf817ce8a64cee11b823b66a987f51aaa9fba0d6a91b3e6bf0d5a5d1042de8e9eeea057b217f8@10.0.1.36:30301?discport=17"),
|
MustParseNode("essnode://9bffefd833d53fac8e652415f4973bee289e8b1a5c6c4cbe70abf817ce8a64cee11b823b66a987f51aaa9fba0d6a91b3e6bf0d5a5d1042de8e9eeea057b217f8@10.0.1.36:30301?discport=17"),
|
||||||
MustParseNode("enode://1b5b4aa662d7cb44a7221bfba67302590b643028197a7d5214790f3bac7aaa4a3241be9e83c09cf1f6c69d007c634faae3dc1b1221793e8446c0b3a09de65960@10.0.1.16:30303"),
|
MustParseNode("essnode://1b5b4aa662d7cb44a7221bfba67302590b643028197a7d5214790f3bac7aaa4a3241be9e83c09cf1f6c69d007c634faae3dc1b1221793e8446c0b3a09de65960@10.0.1.16:30303"),
|
||||||
}
|
}
|
||||||
rpclist := make([]rpcNode, len(list))
|
rpclist := make([]rpcNode, len(list))
|
||||||
for i := range list {
|
for i := range list {
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ func (n *Node) validateComplete() error {
|
||||||
// The string representation of a Node is a URL.
|
// The string representation of a Node is a URL.
|
||||||
// Please see ParseNode for a description of the format.
|
// Please see ParseNode for a description of the format.
|
||||||
func (n *Node) String() string {
|
func (n *Node) String() string {
|
||||||
u := url.URL{Scheme: "enode"}
|
u := url.URL{Scheme: "essnode"}
|
||||||
if n.Incomplete() {
|
if n.Incomplete() {
|
||||||
u.Host = fmt.Sprintf("%x", n.ID[:])
|
u.Host = fmt.Sprintf("%x", n.ID[:])
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -123,7 +123,7 @@ func (n *Node) String() string {
|
||||||
return u.String()
|
return u.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
var incompleteNodeURL = regexp.MustCompile("(?i)^(?:enode://)?([0-9a-f]+)$")
|
var incompleteNodeURL = regexp.MustCompile("(?i)^(?:essnode://)?([0-9a-f]+)$")
|
||||||
|
|
||||||
// ParseNode parses a node designator.
|
// ParseNode parses a node designator.
|
||||||
//
|
//
|
||||||
|
|
@ -133,7 +133,7 @@ var incompleteNodeURL = regexp.MustCompile("(?i)^(?:enode://)?([0-9a-f]+)$")
|
||||||
//
|
//
|
||||||
// For incomplete nodes, the designator must look like one of these
|
// For incomplete nodes, the designator must look like one of these
|
||||||
//
|
//
|
||||||
// enode://<hex node id>
|
// essnode://<hex node id>
|
||||||
// <hex node id>
|
// <hex node id>
|
||||||
//
|
//
|
||||||
// For complete nodes, the node ID is encoded in the username portion
|
// For complete nodes, the node ID is encoded in the username portion
|
||||||
|
|
@ -147,7 +147,7 @@ var incompleteNodeURL = regexp.MustCompile("(?i)^(?:enode://)?([0-9a-f]+)$")
|
||||||
// a node with IP address 10.3.58.6, TCP listening port 30303
|
// a node with IP address 10.3.58.6, TCP listening port 30303
|
||||||
// and UDP discovery port 30301.
|
// and UDP discovery port 30301.
|
||||||
//
|
//
|
||||||
// enode://<hex node id>@10.3.58.6:30303?discport=30301
|
// essnode://<hex node id>@10.3.58.6:30303?discport=30301
|
||||||
func ParseNode(rawurl string) (*Node, error) {
|
func ParseNode(rawurl string) (*Node, error) {
|
||||||
if m := incompleteNodeURL.FindStringSubmatch(rawurl); m != nil {
|
if m := incompleteNodeURL.FindStringSubmatch(rawurl); m != nil {
|
||||||
id, err := HexID(m[1])
|
id, err := HexID(m[1])
|
||||||
|
|
@ -169,8 +169,8 @@ func parseComplete(rawurl string) (*Node, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if u.Scheme != "enode" {
|
if u.Scheme != "essnode" {
|
||||||
return nil, errors.New("invalid URL scheme, want \"enode\"")
|
return nil, errors.New("invalid URL scheme, want \"essnode\"")
|
||||||
}
|
}
|
||||||
// Parse the Node ID from the user portion.
|
// Parse the Node ID from the user portion.
|
||||||
if u.User == nil {
|
if u.User == nil {
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,9 @@ func ExampleNewNode() {
|
||||||
fmt.Println("n2.Incomplete() ->", n2.Incomplete())
|
fmt.Println("n2.Incomplete() ->", n2.Incomplete())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// n1: enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[2001:db8:3c4d:15::abcd:ef12]:30303?discport=52150
|
// n1: essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[2001:db8:3c4d:15::abcd:ef12]:30303?discport=52150
|
||||||
// n1.Incomplete() -> false
|
// n1.Incomplete() -> false
|
||||||
// n2: enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439
|
// n2: essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439
|
||||||
// n2.Incomplete() -> true
|
// n2.Incomplete() -> true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,27 +59,27 @@ var parseNodeTests = []struct {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
rawurl: "http://foobar",
|
rawurl: "http://foobar",
|
||||||
wantError: `invalid URL scheme, want "enode"`,
|
wantError: `invalid URL scheme, want "essnode"`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://01010101@123.124.125.126:3",
|
rawurl: "essnode://01010101@123.124.125.126:3",
|
||||||
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
||||||
},
|
},
|
||||||
// Complete nodes with IP address.
|
// Complete nodes with IP address.
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@hostname:3",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@hostname:3",
|
||||||
wantError: `invalid IP address`,
|
wantError: `invalid IP address`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:foo",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:foo",
|
||||||
wantError: `invalid port`,
|
wantError: `invalid port`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:3?discport=foo",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:3?discport=foo",
|
||||||
wantError: `invalid discport in query`,
|
wantError: `invalid discport in query`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:52150",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:52150",
|
||||||
wantResult: NewNode(
|
wantResult: NewNode(
|
||||||
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
||||||
net.IP{0x7f, 0x0, 0x0, 0x1},
|
net.IP{0x7f, 0x0, 0x0, 0x1},
|
||||||
|
|
@ -88,7 +88,7 @@ var parseNodeTests = []struct {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[::]:52150",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[::]:52150",
|
||||||
wantResult: NewNode(
|
wantResult: NewNode(
|
||||||
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
||||||
net.ParseIP("::"),
|
net.ParseIP("::"),
|
||||||
|
|
@ -97,7 +97,7 @@ var parseNodeTests = []struct {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[2001:db8:3c4d:15::abcd:ef12]:52150",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@[2001:db8:3c4d:15::abcd:ef12]:52150",
|
||||||
wantResult: NewNode(
|
wantResult: NewNode(
|
||||||
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
||||||
net.ParseIP("2001:db8:3c4d:15::abcd:ef12"),
|
net.ParseIP("2001:db8:3c4d:15::abcd:ef12"),
|
||||||
|
|
@ -106,7 +106,7 @@ var parseNodeTests = []struct {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:52150?discport=22334",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:52150?discport=22334",
|
||||||
wantResult: NewNode(
|
wantResult: NewNode(
|
||||||
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
||||||
net.IP{0x7f, 0x0, 0x0, 0x1},
|
net.IP{0x7f, 0x0, 0x0, 0x1},
|
||||||
|
|
@ -123,7 +123,7 @@ var parseNodeTests = []struct {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439",
|
rawurl: "essnode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439",
|
||||||
wantResult: NewNode(
|
wantResult: NewNode(
|
||||||
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"),
|
||||||
nil, 0, 0,
|
nil, 0, 0,
|
||||||
|
|
@ -135,7 +135,7 @@ var parseNodeTests = []struct {
|
||||||
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rawurl: "enode://01010101",
|
rawurl: "essnode://01010101",
|
||||||
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
wantError: `invalid node ID (wrong length, want 128 hex chars)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -170,7 +170,7 @@ func TestParseNode(t *testing.T) {
|
||||||
|
|
||||||
func TestNodeString(t *testing.T) {
|
func TestNodeString(t *testing.T) {
|
||||||
for i, test := range parseNodeTests {
|
for i, test := range parseNodeTests {
|
||||||
if test.wantError == "" && strings.HasPrefix(test.rawurl, "enode://") {
|
if test.wantError == "" && strings.HasPrefix(test.rawurl, "essnode://") {
|
||||||
str := test.wantResult.String()
|
str := test.wantResult.String()
|
||||||
if str != test.rawurl {
|
if str != test.rawurl {
|
||||||
t.Errorf("test %d: Node.String() mismatch:\ngot: %s\nwant: %s", i, str, test.rawurl)
|
t.Errorf("test %d: Node.String() mismatch:\ngot: %s\nwant: %s", i, str, test.rawurl)
|
||||||
|
|
|
||||||
|
|
@ -184,10 +184,10 @@ var (
|
||||||
//
|
//
|
||||||
// // send the reply as two packets.
|
// // send the reply as two packets.
|
||||||
// list := []*Node{
|
// list := []*Node{
|
||||||
// MustParseNode("enode://ba85011c70bcc5c04d8607d3a0ed29aa6179c092cbdda10d5d32684fb33ed01bd94f588ca8f91ac48318087dcb02eaf36773a7a453f0eedd6742af668097b29c@10.0.1.16:30303?discport=30304"),
|
// MustParseNode("essnode://ba85011c70bcc5c04d8607d3a0ed29aa6179c092cbdda10d5d32684fb33ed01bd94f588ca8f91ac48318087dcb02eaf36773a7a453f0eedd6742af668097b29c@10.0.1.16:30303?discport=30304"),
|
||||||
// MustParseNode("enode://81fa361d25f157cd421c60dcc28d8dac5ef6a89476633339c5df30287474520caca09627da18543d9079b5b288698b542d56167aa5c09111e55acdbbdf2ef799@10.0.1.16:30303"),
|
// MustParseNode("essnode://81fa361d25f157cd421c60dcc28d8dac5ef6a89476633339c5df30287474520caca09627da18543d9079b5b288698b542d56167aa5c09111e55acdbbdf2ef799@10.0.1.16:30303"),
|
||||||
// MustParseNode("enode://9bffefd833d53fac8e652415f4973bee289e8b1a5c6c4cbe70abf817ce8a64cee11b823b66a987f51aaa9fba0d6a91b3e6bf0d5a5d1042de8e9eeea057b217f8@10.0.1.36:30301?discport=17"),
|
// MustParseNode("essnode://9bffefd833d53fac8e652415f4973bee289e8b1a5c6c4cbe70abf817ce8a64cee11b823b66a987f51aaa9fba0d6a91b3e6bf0d5a5d1042de8e9eeea057b217f8@10.0.1.36:30301?discport=17"),
|
||||||
// MustParseNode("enode://1b5b4aa662d7cb44a7221bfba67302590b643028197a7d5214790f3bac7aaa4a3241be9e83c09cf1f6c69d007c634faae3dc1b1221793e8446c0b3a09de65960@10.0.1.16:30303"),
|
// MustParseNode("essnode://1b5b4aa662d7cb44a7221bfba67302590b643028197a7d5214790f3bac7aaa4a3241be9e83c09cf1f6c69d007c634faae3dc1b1221793e8446c0b3a09de65960@10.0.1.16:30303"),
|
||||||
// }
|
// }
|
||||||
// rpclist := make([]rpcNode, len(list))
|
// rpclist := make([]rpcNode, len(list))
|
||||||
// for i := range list {
|
// for i := range list {
|
||||||
|
|
|
||||||
|
|
@ -907,11 +907,11 @@ func (srv *Server) runPeer(p *Peer) {
|
||||||
|
|
||||||
// NodeInfo represents a short summary of the information known about the host.
|
// NodeInfo represents a short summary of the information known about the host.
|
||||||
type NodeInfo struct {
|
type NodeInfo struct {
|
||||||
ID string `json:"id"` // Unique node identifier (also the encryption key)
|
ID string `json:"id"` // Unique node identifier (also the encryption key)
|
||||||
Name string `json:"name"` // Name of the node, including client type, version, OS, custom data
|
Name string `json:"name"` // Name of the node, including client type, version, OS, custom data
|
||||||
Enode string `json:"enode"` // Enode URL for adding this peer from remote peers
|
ESSNode string `json:"essnode"` // ESSNode URL for adding this peer from remote peers
|
||||||
IP string `json:"ip"` // IP address of the node
|
IP string `json:"ip"` // IP address of the node
|
||||||
Ports struct {
|
Ports struct {
|
||||||
Discovery int `json:"discovery"` // UDP listening port for discovery protocol
|
Discovery int `json:"discovery"` // UDP listening port for discovery protocol
|
||||||
Listener int `json:"listener"` // TCP listening port for RLPx
|
Listener int `json:"listener"` // TCP listening port for RLPx
|
||||||
} `json:"ports"`
|
} `json:"ports"`
|
||||||
|
|
@ -926,7 +926,7 @@ func (srv *Server) NodeInfo() *NodeInfo {
|
||||||
// Gather and assemble the generic node infos
|
// Gather and assemble the generic node infos
|
||||||
info := &NodeInfo{
|
info := &NodeInfo{
|
||||||
Name: srv.Name,
|
Name: srv.Name,
|
||||||
Enode: node.String(),
|
ESSNode: node.String(),
|
||||||
ID: node.ID.String(),
|
ID: node.ID.String(),
|
||||||
IP: node.IP.String(),
|
IP: node.IP.String(),
|
||||||
ListenAddr: srv.ListenAddr,
|
ListenAddr: srv.ListenAddr,
|
||||||
|
|
|
||||||
|
|
@ -135,12 +135,12 @@ type ExecNode struct {
|
||||||
key *ecdsa.PrivateKey
|
key *ecdsa.PrivateKey
|
||||||
}
|
}
|
||||||
|
|
||||||
// Addr returns the node's enode URL
|
// Addr returns the node's essnode URL
|
||||||
func (n *ExecNode) Addr() []byte {
|
func (n *ExecNode) Addr() []byte {
|
||||||
if n.Info == nil {
|
if n.Info == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return []byte(n.Info.Enode)
|
return []byte(n.Info.ESSNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client returns an rpc.Client which can be used to communicate with the
|
// Client returns an rpc.Client which can be used to communicate with the
|
||||||
|
|
@ -333,7 +333,7 @@ type execNodeConfig struct {
|
||||||
PeerAddrs map[string]string `json:"peer_addrs,omitempty"`
|
PeerAddrs map[string]string `json:"peer_addrs,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExternalIP gets an external IP address so that Enode URL is usable
|
// ExternalIP gets an external IP address so that ESSNode URL is usable
|
||||||
func ExternalIP() net.IP {
|
func ExternalIP() net.IP {
|
||||||
addrs, err := net.InterfaceAddrs()
|
addrs, err := net.InterfaceAddrs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -345,8 +345,8 @@ func (sn *SimNode) NodeInfo() *p2p.NodeInfo {
|
||||||
server := sn.Server()
|
server := sn.Server()
|
||||||
if server == nil {
|
if server == nil {
|
||||||
return &p2p.NodeInfo{
|
return &p2p.NodeInfo{
|
||||||
ID: sn.ID.String(),
|
ID: sn.ID.String(),
|
||||||
Enode: sn.Node().String(),
|
ESSNode: sn.Node().String(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return server.NodeInfo()
|
return server.NodeInfo()
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ import (
|
||||||
// * DockerNode - A Docker container node
|
// * DockerNode - A Docker container node
|
||||||
//
|
//
|
||||||
type Node interface {
|
type Node interface {
|
||||||
// Addr returns the node's address (e.g. an Enode URL)
|
// Addr returns the node's address (e.g. an ESSNode URL)
|
||||||
Addr() []byte
|
Addr() []byte
|
||||||
|
|
||||||
// Client returns the RPC client which is created once the node is
|
// Client returns the RPC client which is created once the node is
|
||||||
|
|
|
||||||
|
|
@ -16,43 +16,43 @@
|
||||||
|
|
||||||
package params
|
package params
|
||||||
|
|
||||||
// MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on
|
// MainnetBootnodes are the essnode URLs of the P2P bootstrap nodes running on
|
||||||
// the main Ethereum network.
|
// the main Ethereum network.
|
||||||
var MainnetBootnodes = []string{
|
var MainnetBootnodes = []string{
|
||||||
// Ethereum Foundation Go Bootnodes
|
// Ethereum Foundation Go Bootnodes
|
||||||
//"enode://529ff813aa5697a6106c75afa2083ff1146bf6328e708bd2db4109a8dea48ca4b3ea66486e5115d72ffe039287f021f4d0ee2dfe504ce01bf600dd80c3caa691@192.168.0.104:30303", // IE
|
//"essnode://529ff813aa5697a6106c75afa2083ff1146bf6328e708bd2db4109a8dea48ca4b3ea66486e5115d72ffe039287f021f4d0ee2dfe504ce01bf600dd80c3caa691@192.168.0.104:30303", // IE
|
||||||
//"enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303", // US-WEST
|
//"essnode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303", // US-WEST
|
||||||
//"enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303", // BR
|
//"essnode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303", // BR
|
||||||
//"enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303", // AU
|
//"essnode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303", // AU
|
||||||
//"enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303", // SG
|
//"essnode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303", // SG
|
||||||
|
|
||||||
// Ethereum Foundation C++ Bootnodes
|
// Ethereum Foundation C++ Bootnodes
|
||||||
//"enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303", // DE
|
//"essnode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303", // DE
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the
|
// TestnetBootnodes are the essnode URLs of the P2P bootstrap nodes running on the
|
||||||
// Ropsten test network.
|
// Ropsten test network.
|
||||||
var TestnetBootnodes = []string{
|
var TestnetBootnodes = []string{
|
||||||
//"enode://e47d2c5d365ba95d92a7ad9aafa40034ab204027cbdab5390aabc2fb99dcb2c1bfa90ba2b9a7d8e7d904fe9653f7dbf076eda929a100269cbacb692e23438c3f@192.168.10.113:30303",
|
//"essnode://e47d2c5d365ba95d92a7ad9aafa40034ab204027cbdab5390aabc2fb99dcb2c1bfa90ba2b9a7d8e7d904fe9653f7dbf076eda929a100269cbacb692e23438c3f@192.168.10.113:30303",
|
||||||
//"enode://30b7ab30a01c124a6cceca36863ece12c4f5fa68e3ba9b0b51407ccc002eeed3b3102d20a88f1c1d3c3154e2449317b8ef95090e77b312d5cc39354f86d5d606@52.176.7.10:30303", // US-Azure geth
|
//"essnode://30b7ab30a01c124a6cceca36863ece12c4f5fa68e3ba9b0b51407ccc002eeed3b3102d20a88f1c1d3c3154e2449317b8ef95090e77b312d5cc39354f86d5d606@52.176.7.10:30303", // US-Azure geth
|
||||||
// "enode://865a63255b3bb68023b6bffd5095118fcc13e79dcf014fe4e47e065c350c7cc72af2e53eff895f11ba1bbb6a2b33271c1116ee870f266618eadfc2e78aa7349c@52.176.100.77:30303", // US-Azure parity
|
// "essnode://865a63255b3bb68023b6bffd5095118fcc13e79dcf014fe4e47e065c350c7cc72af2e53eff895f11ba1bbb6a2b33271c1116ee870f266618eadfc2e78aa7349c@52.176.100.77:30303", // US-Azure parity
|
||||||
// "enode://6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f@52.232.243.152:30303", // Parity
|
// "essnode://6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f@52.232.243.152:30303", // Parity
|
||||||
// "enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303", // @gpip
|
// "essnode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303", // @gpip
|
||||||
}
|
}
|
||||||
|
|
||||||
// RinkebyBootnodes are the enode URLs of the P2P bootstrap nodes running on the
|
// RinkebyBootnodes are the essnode URLs of the P2P bootstrap nodes running on the
|
||||||
// Rinkeby test network.
|
// Rinkeby test network.
|
||||||
var RinkebyBootnodes = []string{
|
var RinkebyBootnodes = []string{
|
||||||
//"enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303", // IE
|
//"essnode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303", // IE
|
||||||
//"enode://343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8@52.3.158.184:30303", // INFURA
|
//"essnode://343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8@52.3.158.184:30303", // INFURA
|
||||||
//"enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303", // AKASHA
|
//"essnode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303", // AKASHA
|
||||||
}
|
}
|
||||||
|
|
||||||
// DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the
|
// DiscoveryV5Bootnodes are the essnode URLs of the P2P bootstrap nodes for the
|
||||||
// experimental RLPx v5 topic-discovery network.
|
// experimental RLPx v5 topic-discovery network.
|
||||||
var DiscoveryV5Bootnodes = []string{
|
var DiscoveryV5Bootnodes = []string{
|
||||||
//"enode://06051a5573c81934c9554ef2898eb13b33a34b94cf36b202b69fde139ca17a85051979867720d4bdae4323d4943ddf9aeeb6643633aa656e0be843659795007a@35.177.226.168:30303",
|
//"essnode://06051a5573c81934c9554ef2898eb13b33a34b94cf36b202b69fde139ca17a85051979867720d4bdae4323d4943ddf9aeeb6643633aa656e0be843659795007a@35.177.226.168:30303",
|
||||||
//"enode://0cc5f5ffb5d9098c8b8c62325f3797f56509bff942704687b6530992ac706e2cb946b90a34f1f19548cd3c7baccbcaea354531e5983c7d1bc0dee16ce4b6440b@40.118.3.223:30304",
|
//"essnode://0cc5f5ffb5d9098c8b8c62325f3797f56509bff942704687b6530992ac706e2cb946b90a34f1f19548cd3c7baccbcaea354531e5983c7d1bc0dee16ce4b6440b@40.118.3.223:30304",
|
||||||
//"enode://1c7a64d76c0334b0418c004af2f67c50e36a3be60b5e4790bdac0439d21603469a85fad36f2473c9a80eb043ae60936df905fa28f1ff614c3e5dc34f15dcd2dc@40.118.3.223:30306",
|
//"essnode://1c7a64d76c0334b0418c004af2f67c50e36a3be60b5e4790bdac0439d21603469a85fad36f2473c9a80eb043ae60936df905fa28f1ff614c3e5dc34f15dcd2dc@40.118.3.223:30306",
|
||||||
//"enode://85c85d7143ae8bb96924f2b54f1b3e70d8c4d367af305325d30a61385a432f247d2c75c45c6b4a60335060d072d7f5b35dd1d4c45f76941f62a4f83b6e75daaf@40.118.3.223:30307",
|
//"essnode://85c85d7143ae8bb96924f2b54f1b3e70d8c4d367af305325d30a61385a432f247d2c75c45c6b4a60335060d072d7f5b35dd1d4c45f76941f62a4f83b6e75daaf@40.118.3.223:30307",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ BOOTNODE_IP="192.168.33.2"
|
||||||
BOOTNODE_PORT="30301"
|
BOOTNODE_PORT="30301"
|
||||||
BOOTNODE_KEY="32078f313bea771848db70745225c52c00981589ad6b5b49163f0f5ee852617d"
|
BOOTNODE_KEY="32078f313bea771848db70745225c52c00981589ad6b5b49163f0f5ee852617d"
|
||||||
BOOTNODE_PUBKEY="760c4460e5336ac9bbd87952a3c7ec4363fc0a97bd31c86430806e287b437fd1b01abc6e1db640cf3106b520344af1d58b00b57823db3e1407cbc433e1b6d04d"
|
BOOTNODE_PUBKEY="760c4460e5336ac9bbd87952a3c7ec4363fc0a97bd31c86430806e287b437fd1b01abc6e1db640cf3106b520344af1d58b00b57823db3e1407cbc433e1b6d04d"
|
||||||
BOOTNODE_URL="enode://${BOOTNODE_PUBKEY}@${BOOTNODE_IP}:${BOOTNODE_PORT}"
|
BOOTNODE_URL="essnode://${BOOTNODE_PUBKEY}@${BOOTNODE_IP}:${BOOTNODE_PORT}"
|
||||||
|
|
||||||
# static geth configuration
|
# static geth configuration
|
||||||
GETH_IP="192.168.33.3"
|
GETH_IP="192.168.33.3"
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ func NewHive(params *HiveParams, overlay Overlay, store state.Store) *Hive {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start stars the hive, receives p2p.Server only at startup
|
// Start stars the hive, receives p2p.Server only at startup
|
||||||
// server is used to connect to a peer based on its ESSNodeID or enode URL
|
// server is used to connect to a peer based on its ESSNodeID or essnode URL
|
||||||
// these are called on the p2p.Server which runs on the node
|
// these are called on the p2p.Server which runs on the node
|
||||||
func (h *Hive) Start(server *p2p.Server) error {
|
func (h *Hive) Start(server *p2p.Server) error {
|
||||||
log.Info(fmt.Sprintf("%08x hive starting", h.BaseAddr()[:4]))
|
log.Info(fmt.Sprintf("%08x hive starting", h.BaseAddr()[:4]))
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,7 @@ func (a *BzzAddr) Under() []byte {
|
||||||
return a.UAddr
|
return a.UAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID returns the nodeID from the underlay enode address
|
// ID returns the nodeID from the underlay essnode address
|
||||||
func (a *BzzAddr) ID() discover.ESSNodeID {
|
func (a *BzzAddr) ID() discover.ESSNodeID {
|
||||||
return discover.MustParseNode(string(a.UAddr)).ID
|
return discover.MustParseNode(string(a.UAddr)).ID
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1223,7 +1223,7 @@ func TestDeduplication(t *testing.T) {
|
||||||
var rpubkey string
|
var rpubkey string
|
||||||
err = clients[1].Call(&rpubkey, "pss_getPublicKey")
|
err = clients[1].Call(&rpubkey, "pss_getPublicKey")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("rpc get receivenode pubkey fail: %v", err)
|
t.Fatalf("rpc get receivessnode pubkey fail: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(time.Millisecond * 500) // replace with hive healthy code
|
time.Sleep(time.Millisecond * 500) // replace with hive healthy code
|
||||||
|
|
|
||||||
2
swarm/pss/testdata/snapshot_128.json
vendored
2
swarm/pss/testdata/snapshot_128.json
vendored
File diff suppressed because one or more lines are too long
2
swarm/pss/testdata/snapshot_16.json
vendored
2
swarm/pss/testdata/snapshot_16.json
vendored
File diff suppressed because one or more lines are too long
4
swarm/pss/testdata/snapshot_2.json
vendored
4
swarm/pss/testdata/snapshot_2.json
vendored
|
|
@ -30,7 +30,7 @@
|
||||||
},
|
},
|
||||||
"name":"node01",
|
"name":"node01",
|
||||||
"id":"7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66",
|
"id":"7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66",
|
||||||
"enode":"enode://7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66@0.0.0.0:0"
|
"essnode":"essnode://7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66@0.0.0.0:0"
|
||||||
},
|
},
|
||||||
"up":true
|
"up":true
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
},
|
},
|
||||||
"id":"0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5",
|
"id":"0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5",
|
||||||
"name":"node02",
|
"name":"node02",
|
||||||
"enode":"enode://0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5@0.0.0.0:0"
|
"essnode":"essnode://0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5@0.0.0.0:0"
|
||||||
},
|
},
|
||||||
"config":{
|
"config":{
|
||||||
"name":"node02",
|
"name":"node02",
|
||||||
|
|
|
||||||
2
swarm/pss/testdata/snapshot_256.json
vendored
2
swarm/pss/testdata/snapshot_256.json
vendored
File diff suppressed because one or more lines are too long
6
swarm/pss/testdata/snapshot_3.json
vendored
6
swarm/pss/testdata/snapshot_3.json
vendored
|
|
@ -35,7 +35,7 @@
|
||||||
},
|
},
|
||||||
"name":"node01",
|
"name":"node01",
|
||||||
"id":"7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66",
|
"id":"7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66",
|
||||||
"enode":"enode://7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66@0.0.0.0:0"
|
"essnode":"essnode://7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66@0.0.0.0:0"
|
||||||
},
|
},
|
||||||
"up":true
|
"up":true
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
},
|
},
|
||||||
"id":"0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5",
|
"id":"0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5",
|
||||||
"name":"node02",
|
"name":"node02",
|
||||||
"enode":"enode://0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5@0.0.0.0:0"
|
"essnode":"essnode://0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5@0.0.0.0:0"
|
||||||
},
|
},
|
||||||
"config":{
|
"config":{
|
||||||
"name":"node02",
|
"name":"node02",
|
||||||
|
|
@ -91,7 +91,7 @@
|
||||||
},
|
},
|
||||||
"name":"node03",
|
"name":"node03",
|
||||||
"id":"6f6ee658538ea66a68c9cb914d09f228f6ee9942c337a8d5a2cb3a0f021e83dd0fab481ca8ebf56ed913f6ddf69caa3249459d43e61e5e5b162ded7e1c918c9c",
|
"id":"6f6ee658538ea66a68c9cb914d09f228f6ee9942c337a8d5a2cb3a0f021e83dd0fab481ca8ebf56ed913f6ddf69caa3249459d43e61e5e5b162ded7e1c918c9c",
|
||||||
"enode":"enode://6f6ee658538ea66a68c9cb914d09f228f6ee9942c337a8d5a2cb3a0f021e83dd0fab481ca8ebf56ed913f6ddf69caa3249459d43e61e5e5b162ded7e1c918c9c@0.0.0.0:0"
|
"essnode":"essnode://6f6ee658538ea66a68c9cb914d09f228f6ee9942c337a8d5a2cb3a0f021e83dd0fab481ca8ebf56ed913f6ddf69caa3249459d43e61e5e5b162ded7e1c918c9c@0.0.0.0:0"
|
||||||
},
|
},
|
||||||
"up":true
|
"up":true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
swarm/pss/testdata/snapshot_32.json
vendored
2
swarm/pss/testdata/snapshot_32.json
vendored
File diff suppressed because one or more lines are too long
8
swarm/pss/testdata/snapshot_4.json
vendored
8
swarm/pss/testdata/snapshot_4.json
vendored
|
|
@ -40,7 +40,7 @@
|
||||||
},
|
},
|
||||||
"name":"node01",
|
"name":"node01",
|
||||||
"id":"7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66",
|
"id":"7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66",
|
||||||
"enode":"enode://7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66@0.0.0.0:0"
|
"essnode":"essnode://7b12f55c7c012104e006775d03b89722b403fb0e1ecb79af8cadfa6947425aedb323fb9416c84b782d35f3216acb5d94a1dd31d60a3eba45f9051bf503de1b66@0.0.0.0:0"
|
||||||
},
|
},
|
||||||
"up":true
|
"up":true
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
},
|
},
|
||||||
"id":"0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5",
|
"id":"0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5",
|
||||||
"name":"node02",
|
"name":"node02",
|
||||||
"enode":"enode://0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5@0.0.0.0:0"
|
"essnode":"essnode://0eec333dd211c2ea81db614fe58bf0300c15e50e1b044e47ef93067a6cdbc3bc666b40bdcc515bbf580355dbef9370294ef1ee92ee0525e78a8beed00c2b99f5@0.0.0.0:0"
|
||||||
},
|
},
|
||||||
"config":{
|
"config":{
|
||||||
"name":"node02",
|
"name":"node02",
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
},
|
},
|
||||||
"name":"node03",
|
"name":"node03",
|
||||||
"id":"6f6ee658538ea66a68c9cb914d09f228f6ee9942c337a8d5a2cb3a0f021e83dd0fab481ca8ebf56ed913f6ddf69caa3249459d43e61e5e5b162ded7e1c918c9c",
|
"id":"6f6ee658538ea66a68c9cb914d09f228f6ee9942c337a8d5a2cb3a0f021e83dd0fab481ca8ebf56ed913f6ddf69caa3249459d43e61e5e5b162ded7e1c918c9c",
|
||||||
"enode":"enode://6f6ee658538ea66a68c9cb914d09f228f6ee9942c337a8d5a2cb3a0f021e83dd0fab481ca8ebf56ed913f6ddf69caa3249459d43e61e5e5b162ded7e1c918c9c@0.0.0.0:0"
|
"essnode":"essnode://6f6ee658538ea66a68c9cb914d09f228f6ee9942c337a8d5a2cb3a0f021e83dd0fab481ca8ebf56ed913f6ddf69caa3249459d43e61e5e5b162ded7e1c918c9c@0.0.0.0:0"
|
||||||
},
|
},
|
||||||
"up":true
|
"up":true
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +106,7 @@
|
||||||
"info":{
|
"info":{
|
||||||
"name":"node04",
|
"name":"node04",
|
||||||
"id":"83388147883592bab4fdaddb4e56f8cb1c56dc5c2e910fc6a7277ac89b77cc7ce24892ed6984f3414589cb3b8c4b69356ff9aab7ca52fdd58f12dee2a2152523",
|
"id":"83388147883592bab4fdaddb4e56f8cb1c56dc5c2e910fc6a7277ac89b77cc7ce24892ed6984f3414589cb3b8c4b69356ff9aab7ca52fdd58f12dee2a2152523",
|
||||||
"enode":"enode://83388147883592bab4fdaddb4e56f8cb1c56dc5c2e910fc6a7277ac89b77cc7ce24892ed6984f3414589cb3b8c4b69356ff9aab7ca52fdd58f12dee2a2152523@0.0.0.0:0",
|
"essnode":"essnode://83388147883592bab4fdaddb4e56f8cb1c56dc5c2e910fc6a7277ac89b77cc7ce24892ed6984f3414589cb3b8c4b69356ff9aab7ca52fdd58f12dee2a2152523@0.0.0.0:0",
|
||||||
"ip":"0.0.0.0",
|
"ip":"0.0.0.0",
|
||||||
"listenAddr":"",
|
"listenAddr":"",
|
||||||
"protocols":{
|
"protocols":{
|
||||||
|
|
|
||||||
2
swarm/pss/testdata/snapshot_64.json
vendored
2
swarm/pss/testdata/snapshot_64.json
vendored
File diff suppressed because one or more lines are too long
2
swarm/pss/testdata/snapshot_8.json
vendored
2
swarm/pss/testdata/snapshot_8.json
vendored
File diff suppressed because one or more lines are too long
|
|
@ -345,7 +345,7 @@ func (self *Swarm) Start(srv *p2p.Server) error {
|
||||||
|
|
||||||
self.tracerClose = tracing.Closer
|
self.tracerClose = tracing.Closer
|
||||||
|
|
||||||
// update uaddr to correct enode
|
// update uaddr to correct essnode
|
||||||
newaddr := self.bzz.UpdateLocalAddr([]byte(srv.Self().String()))
|
newaddr := self.bzz.UpdateLocalAddr([]byte(srv.Self().String()))
|
||||||
log.Warn("Updated bzz local addr", "oaddr", fmt.Sprintf("%x", newaddr.OAddr), "uaddr", fmt.Sprintf("%s", newaddr.UAddr))
|
log.Warn("Updated bzz local addr", "oaddr", fmt.Sprintf("%x", newaddr.OAddr), "uaddr", fmt.Sprintf("%s", newaddr.UAddr))
|
||||||
// set chequebook
|
// set chequebook
|
||||||
|
|
|
||||||
|
|
@ -446,7 +446,7 @@ func (db *Database) Dereference(root common.Hash) {
|
||||||
memcacheGCNodesMeter.Mark(int64(nodes - len(db.nodes)))
|
memcacheGCNodesMeter.Mark(int64(nodes - len(db.nodes)))
|
||||||
|
|
||||||
log.Debug("Dereferenced trie from memory database", "nodes", nodes-len(db.nodes), "size", storage-db.nodesSize, "time", time.Since(start),
|
log.Debug("Dereferenced trie from memory database", "nodes", nodes-len(db.nodes), "size", storage-db.nodesSize, "time", time.Since(start),
|
||||||
"gcnodes", db.gcnodes, "gcsize", db.gcsize, "gctime", db.gctime, "livenodes", len(db.nodes), "livesize", db.nodesSize)
|
"gcnodes", db.gcnodes, "gcsize", db.gcsize, "gctime", db.gctime, "livessnodes", len(db.nodes), "livesize", db.nodesSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// dereference is the private locked version of Dereference.
|
// dereference is the private locked version of Dereference.
|
||||||
|
|
@ -586,7 +586,7 @@ func (db *Database) Cap(limit common.StorageSize) error {
|
||||||
memcacheFlushNodesMeter.Mark(int64(nodes - len(db.nodes)))
|
memcacheFlushNodesMeter.Mark(int64(nodes - len(db.nodes)))
|
||||||
|
|
||||||
log.Debug("Persisted nodes from memory database", "nodes", nodes-len(db.nodes), "size", storage-db.nodesSize, "time", time.Since(start),
|
log.Debug("Persisted nodes from memory database", "nodes", nodes-len(db.nodes), "size", storage-db.nodesSize, "time", time.Since(start),
|
||||||
"flushnodes", db.flushnodes, "flushsize", db.flushsize, "flushtime", db.flushtime, "livenodes", len(db.nodes), "livesize", db.nodesSize)
|
"flushnodes", db.flushnodes, "flushsize", db.flushsize, "flushtime", db.flushtime, "livessnodes", len(db.nodes), "livesize", db.nodesSize)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -652,7 +652,7 @@ func (db *Database) Commit(node common.Hash, report bool) error {
|
||||||
logger = log.Debug
|
logger = log.Debug
|
||||||
}
|
}
|
||||||
logger("Persisted trie from memory database", "nodes", nodes-len(db.nodes)+int(db.flushnodes), "size", storage-db.nodesSize+db.flushsize, "time", time.Since(start)+db.flushtime,
|
logger("Persisted trie from memory database", "nodes", nodes-len(db.nodes)+int(db.flushnodes), "size", storage-db.nodesSize+db.flushsize, "time", time.Since(start)+db.flushtime,
|
||||||
"gcnodes", db.gcnodes, "gcsize", db.gcsize, "gctime", db.gctime, "livenodes", len(db.nodes), "livesize", db.nodesSize)
|
"gcnodes", db.gcnodes, "gcsize", db.gcsize, "gctime", db.gctime, "livessnodes", len(db.nodes), "livesize", db.nodesSize)
|
||||||
|
|
||||||
// Reset the garbage collection statistics
|
// Reset the garbage collection statistics
|
||||||
db.gcnodes, db.gcsize, db.gctime = 0, 0, 0
|
db.gcnodes, db.gcsize, db.gctime = 0, 0, 0
|
||||||
|
|
|
||||||
2
vendor/golang.org/x/net/html/foreign.go
generated
vendored
2
vendor/golang.org/x/net/html/foreign.go
generated
vendored
|
|
@ -140,7 +140,7 @@ var svgTagNameAdjustments = map[string]string{
|
||||||
"fegaussianblur": "feGaussianBlur",
|
"fegaussianblur": "feGaussianBlur",
|
||||||
"feimage": "feImage",
|
"feimage": "feImage",
|
||||||
"femerge": "feMerge",
|
"femerge": "feMerge",
|
||||||
"femergenode": "feMergeNode",
|
"femergessnode": "feMergeNode",
|
||||||
"femorphology": "feMorphology",
|
"femorphology": "feMorphology",
|
||||||
"feoffset": "feOffset",
|
"feoffset": "feOffset",
|
||||||
"fepointlight": "fePointLight",
|
"fepointlight": "fePointLight",
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,9 @@ func (sc *Client) SetMinimumPoW(ctx context.Context, pow float64) error {
|
||||||
|
|
||||||
// MarkTrustedPeer marks specific peer trusted, which will allow it to send historic (expired) messages.
|
// MarkTrustedPeer marks specific peer trusted, which will allow it to send historic (expired) messages.
|
||||||
// Note This function is not adding new nodes, the node needs to exists as a peer.
|
// Note This function is not adding new nodes, the node needs to exists as a peer.
|
||||||
func (sc *Client) MarkTrustedPeer(ctx context.Context, enode string) error {
|
func (sc *Client) MarkTrustedPeer(ctx context.Context, essnode string) error {
|
||||||
var ignored bool
|
var ignored bool
|
||||||
return sc.c.CallContext(ctx, &ignored, "shh_markTrustedPeer", enode)
|
return sc.c.CallContext(ctx, &ignored, "shh_markTrustedPeer", essnode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKeyPair generates a new public and private key pair for message decryption and encryption.
|
// NewKeyPair generates a new public and private key pair for message decryption and encryption.
|
||||||
|
|
|
||||||
|
|
@ -96,8 +96,8 @@ func (api *PublicWhisperAPI) SetMinPoW(ctx context.Context, pow float64) (bool,
|
||||||
|
|
||||||
// MarkTrustedPeer marks a peer trusted. , which will allow it to send historic (expired) messages.
|
// MarkTrustedPeer marks a peer trusted. , which will allow it to send historic (expired) messages.
|
||||||
// Note: This function is not adding new nodes, the node needs to exists as a peer.
|
// Note: This function is not adding new nodes, the node needs to exists as a peer.
|
||||||
func (api *PublicWhisperAPI) MarkTrustedPeer(ctx context.Context, enode string) (bool, error) {
|
func (api *PublicWhisperAPI) MarkTrustedPeer(ctx context.Context, essnode string) (bool, error) {
|
||||||
n, err := discover.ParseNode(enode)
|
n, err := discover.ParseNode(essnode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,8 @@ func (api *PublicWhisperAPI) SetBloomFilter(ctx context.Context, bloom hexutil.B
|
||||||
|
|
||||||
// MarkTrustedPeer marks a peer trusted, which will allow it to send historic (expired) messages.
|
// MarkTrustedPeer marks a peer trusted, which will allow it to send historic (expired) messages.
|
||||||
// Note: This function is not adding new nodes, the node needs to exists as a peer.
|
// Note: This function is not adding new nodes, the node needs to exists as a peer.
|
||||||
func (api *PublicWhisperAPI) MarkTrustedPeer(ctx context.Context, enode string) (bool, error) {
|
func (api *PublicWhisperAPI) MarkTrustedPeer(ctx context.Context, essnode string) (bool, error) {
|
||||||
n, err := discover.ParseNode(enode)
|
n, err := discover.ParseNode(essnode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue