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

This commit is contained in:
JukLee0ira 2025-06-26 10:51:24 +08:00 committed by GitHub
parent b15a8ac67e
commit 1c5b5ea883
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 8 additions and 23 deletions

View file

@ -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),

View file

@ -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

View file

@ -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)

View file

@ -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.

View file

@ -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