Unverified Commit acc2a2ac authored by Sanghee Choi's avatar Sanghee Choi Committed by GitHub

node: remove unused error return from Attach (#27450)

node: Delete the unused error from return parameters of Node.Attach() func
parent 6f08c2f3
...@@ -268,11 +268,7 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*enode.Node, network ui ...@@ -268,11 +268,7 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*enode.Node, network ui
} }
} }
// Attach to the client and retrieve and interesting metadatas // Attach to the client and retrieve and interesting metadatas
api, err := stack.Attach() api := stack.Attach()
if err != nil {
stack.Close()
return nil, err
}
client := ethclient.NewClient(api) client := ethclient.NewClient(api)
return &faucet{ return &faucet{
......
...@@ -75,10 +75,7 @@ func localConsole(ctx *cli.Context) error { ...@@ -75,10 +75,7 @@ func localConsole(ctx *cli.Context) error {
defer stack.Close() defer stack.Close()
// Attach to the newly started node and create the JavaScript console. // Attach to the newly started node and create the JavaScript console.
client, err := stack.Attach() client := stack.Attach()
if err != nil {
return fmt.Errorf("failed to attach to the inproc geth: %v", err)
}
config := console.Config{ config := console.Config{
DataDir: utils.MakeDataDir(ctx), DataDir: utils.MakeDataDir(ctx),
DocRoot: ctx.String(utils.JSpathFlag.Name), DocRoot: ctx.String(utils.JSpathFlag.Name),
......
...@@ -346,10 +346,7 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, isCon ...@@ -346,10 +346,7 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, isCon
stack.AccountManager().Subscribe(events) stack.AccountManager().Subscribe(events)
// Create a client to interact with local geth node. // Create a client to interact with local geth node.
rpcClient, err := stack.Attach() rpcClient := stack.Attach()
if err != nil {
utils.Fatalf("Failed to attach to self: %v", err)
}
ethClient := ethclient.NewClient(rpcClient) ethClient := ethclient.NewClient(rpcClient)
go func() { go func() {
......
...@@ -110,10 +110,7 @@ func newTester(t *testing.T, confOverride func(*ethconfig.Config)) *tester { ...@@ -110,10 +110,7 @@ func newTester(t *testing.T, confOverride func(*ethconfig.Config)) *tester {
if err = stack.Start(); err != nil { if err = stack.Start(); err != nil {
t.Fatalf("failed to start test stack: %v", err) t.Fatalf("failed to start test stack: %v", err)
} }
client, err := stack.Attach() client := stack.Attach()
if err != nil {
t.Fatalf("failed to attach to node: %v", err)
}
prompter := &hookedPrompter{scheduler: make(chan string)} prompter := &hookedPrompter{scheduler: make(chan string)}
printer := new(bytes.Buffer) printer := new(bytes.Buffer)
......
...@@ -250,7 +250,7 @@ func generateTestChain() []*types.Block { ...@@ -250,7 +250,7 @@ func generateTestChain() []*types.Block {
func TestEthClient(t *testing.T) { func TestEthClient(t *testing.T) {
backend, chain := newTestBackend(t) backend, chain := newTestBackend(t)
client, _ := backend.Attach() client := backend.Attach()
defer backend.Close() defer backend.Close()
defer client.Close() defer client.Close()
......
...@@ -94,10 +94,7 @@ func generateTestChain() (*core.Genesis, []*types.Block) { ...@@ -94,10 +94,7 @@ func generateTestChain() (*core.Genesis, []*types.Block) {
func TestGethClient(t *testing.T) { func TestGethClient(t *testing.T) {
backend, _ := newTestBackend(t) backend, _ := newTestBackend(t)
client, err := backend.Attach() client := backend.Attach()
if err != nil {
t.Fatal(err)
}
defer backend.Close() defer backend.Close()
defer client.Close() defer client.Close()
......
...@@ -616,8 +616,8 @@ func (n *Node) RegisterHandler(name, path string, handler http.Handler) { ...@@ -616,8 +616,8 @@ func (n *Node) RegisterHandler(name, path string, handler http.Handler) {
} }
// Attach creates an RPC client attached to an in-process API handler. // Attach creates an RPC client attached to an in-process API handler.
func (n *Node) Attach() (*rpc.Client, error) { func (n *Node) Attach() *rpc.Client {
return rpc.DialInProc(n.inprocHandler), nil return rpc.DialInProc(n.inprocHandler)
} }
// RPCHandler returns the in-process RPC request handler. // RPCHandler returns the in-process RPC request handler.
......
...@@ -147,7 +147,7 @@ func (s *SimAdapter) DialRPC(id enode.ID) (*rpc.Client, error) { ...@@ -147,7 +147,7 @@ func (s *SimAdapter) DialRPC(id enode.ID) (*rpc.Client, error) {
if !ok { if !ok {
return nil, fmt.Errorf("unknown node: %s", id) 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 // GetNode returns the node with the given ID if it exists
...@@ -274,10 +274,7 @@ func (sn *SimNode) Start(snapshots map[string][]byte) error { ...@@ -274,10 +274,7 @@ func (sn *SimNode) Start(snapshots map[string][]byte) error {
} }
// create an in-process RPC client // create an in-process RPC client
client, err := sn.node.Attach() client := sn.node.Attach()
if err != nil {
return err
}
sn.lock.Lock() sn.lock.Lock()
sn.client = client sn.client = client
sn.lock.Unlock() sn.lock.Unlock()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment