mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
parent
b15a8ac67e
commit
1c5b5ea883
5 changed files with 8 additions and 23 deletions
|
|
@ -80,10 +80,7 @@ func localConsole(ctx *cli.Context) error {
|
|||
defer stack.Close()
|
||||
|
||||
// Attach to the newly started node and start the JavaScript console
|
||||
client, err := stack.Attach()
|
||||
if err != nil {
|
||||
utils.Fatalf("failed to attach to the inproc XDC: %v", err)
|
||||
}
|
||||
client := stack.Attach()
|
||||
config := console.Config{
|
||||
DataDir: utils.MakeDataDir(ctx),
|
||||
DocRoot: ctx.String(utils.JSpathFlag.Name),
|
||||
|
|
@ -185,10 +182,7 @@ func ephemeralConsole(ctx *cli.Context) error {
|
|||
defer stack.Close()
|
||||
|
||||
// Attach to the newly started node and start the JavaScript console
|
||||
client, err := stack.Attach()
|
||||
if err != nil {
|
||||
utils.Fatalf("Failed to attach to the inproc XDC: %v", err)
|
||||
}
|
||||
client := stack.Attach()
|
||||
config := console.Config{
|
||||
DataDir: utils.MakeDataDir(ctx),
|
||||
DocRoot: ctx.String(utils.JSpathFlag.Name),
|
||||
|
|
|
|||
|
|
@ -306,10 +306,7 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, cfg X
|
|||
|
||||
go func() {
|
||||
// Create an chain state reader for self-derivation
|
||||
rpcClient, err := stack.Attach()
|
||||
if err != nil {
|
||||
utils.Fatalf("Failed to attach to self: %v", err)
|
||||
}
|
||||
rpcClient := stack.Attach()
|
||||
stateReader := ethclient.NewClient(rpcClient)
|
||||
|
||||
// Open any wallets already attached
|
||||
|
|
|
|||
|
|
@ -112,10 +112,7 @@ func newTester(t *testing.T, confOverride func(*ethconfig.Config)) *tester {
|
|||
if err = stack.Start(); err != nil {
|
||||
t.Fatalf("failed to start test stack: %v", err)
|
||||
}
|
||||
client, err := stack.Attach()
|
||||
if err != nil {
|
||||
t.Fatalf("failed to attach to node: %v", err)
|
||||
}
|
||||
client := stack.Attach()
|
||||
prompter := &hookedPrompter{scheduler: make(chan string)}
|
||||
printer := new(bytes.Buffer)
|
||||
|
||||
|
|
|
|||
|
|
@ -630,8 +630,8 @@ func (n *Node) RegisterHandler(name, path string, handler http.Handler) {
|
|||
}
|
||||
|
||||
// Attach creates an RPC client attached to an in-process API handler.
|
||||
func (n *Node) Attach() (*rpc.Client, error) {
|
||||
return rpc.DialInProc(n.inprocHandler), nil
|
||||
func (n *Node) Attach() *rpc.Client {
|
||||
return rpc.DialInProc(n.inprocHandler)
|
||||
}
|
||||
|
||||
// RPCHandler returns the in-process RPC request handler.
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ func (sa *SimAdapter) DialRPC(id discover.NodeID) (*rpc.Client, error) {
|
|||
if !ok {
|
||||
return nil, fmt.Errorf("unknown node: %s", id)
|
||||
}
|
||||
return node.node.Attach()
|
||||
return node.node.Attach(), nil
|
||||
}
|
||||
|
||||
// GetNode returns the node with the given ID if it exists
|
||||
|
|
@ -261,10 +261,7 @@ func (sn *SimNode) Start(snapshots map[string][]byte) error {
|
|||
}
|
||||
|
||||
// create an in-process RPC client
|
||||
client, err := sn.node.Attach()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
client := sn.node.Attach()
|
||||
|
||||
sn.lock.Lock()
|
||||
sn.client = client
|
||||
|
|
|
|||
Loading…
Reference in a new issue