aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-02-09 20:10:40 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-02-09 20:10:40 +0800
commitdf75dbfd6804923b1c8a8388b67523072d59f155 (patch)
tree5191e9a8004499727a42336be1f092bc04943ae8 /cmd
parent900e124beea551ded290f61e7bf85ff6b2e4a29e (diff)
downloadgo-tangerine-df75dbfd6804923b1c8a8388b67523072d59f155.tar.gz
go-tangerine-df75dbfd6804923b1c8a8388b67523072d59f155.tar.zst
go-tangerine-df75dbfd6804923b1c8a8388b67523072d59f155.zip
cmd, node, rpc: readd inproc RPC client, expose via node
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/js_test.go6
-rw-r--r--cmd/geth/main.go4
-rw-r--r--cmd/utils/client.go1
3 files changed, 4 insertions, 7 deletions
diff --git a/cmd/geth/js_test.go b/cmd/geth/js_test.go
index ed6e5b319..4330b484c 100644
--- a/cmd/geth/js_test.go
+++ b/cmd/geth/js_test.go
@@ -20,7 +20,6 @@ import (
"fmt"
"io/ioutil"
"math/big"
- "math/rand"
"os"
"path/filepath"
"regexp"
@@ -30,7 +29,6 @@ import (
"time"
"github.com/ethereum/go-ethereum/accounts"
- "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/compiler"
"github.com/ethereum/go-ethereum/common/httpclient"
@@ -96,7 +94,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *nod
t.Fatal(err)
}
// Create a networkless protocol stack
- stack, err := node.New(&node.Config{PrivateKey: testNodeKey, Name: "test", NoDiscovery: true, IPCPath: fmt.Sprintf("geth-test-%d.ipc", rand.Int63())})
+ stack, err := node.New(&node.Config{PrivateKey: testNodeKey, Name: "test", NoDiscovery: true})
if err != nil {
t.Fatalf("failed to create node: %v", err)
}
@@ -142,7 +140,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *nod
stack.Service(&ethereum)
assetPath := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist", "assets", "ext")
- client, err := utils.NewRemoteRPCClientFromString("ipc:" + stack.IPCEndpoint())
+ client, err := stack.Attach()
if err != nil {
t.Fatalf("failed to attach to node: %v", err)
}
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 5c07be3f6..8594d18c5 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -425,7 +425,7 @@ func console(ctx *cli.Context) {
startNode(ctx, node)
// Attach to the newly started node, and either execute script or become interactive
- client, err := utils.NewRemoteRPCClientFromString("ipc:" + node.IPCEndpoint())
+ client, err := node.Attach()
if err != nil {
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
}
@@ -451,7 +451,7 @@ func execScripts(ctx *cli.Context) {
startNode(ctx, node)
// Attach to the newly started node and execute the given scripts
- client, err := utils.NewRemoteRPCClientFromString("ipc:" + node.IPCEndpoint())
+ client, err := node.Attach()
if err != nil {
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
}
diff --git a/cmd/utils/client.go b/cmd/utils/client.go
index 1144af6f6..3913d007b 100644
--- a/cmd/utils/client.go
+++ b/cmd/utils/client.go
@@ -51,6 +51,5 @@ func NewRemoteRPCClientFromString(endpoint string) (rpc.Client, error) {
if strings.HasPrefix(endpoint, "ws:") {
return rpc.NewWSClient(endpoint)
}
-
return nil, fmt.Errorf("invalid endpoint")
}