From 8fbd4f396eb10c71ff2d7a586d7fa6db205c4f56 Mon Sep 17 00:00:00 2001 From: Fibonacci747 Date: Wed, 17 Sep 2025 18:12:26 +0200 Subject: [PATCH] rpc: fix example comment and handle Dial error --- rpc/client_example_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rpc/client_example_test.go b/rpc/client_example_test.go index 044b57a9c439..8dbeaf7d4821 100644 --- a/rpc/client_example_test.go +++ b/rpc/client_example_test.go @@ -28,7 +28,7 @@ import ( // In this example, our client wishes to track the latest 'block number' // known to the server. The server supports two methods: // -// eth_getBlockByNumber("latest", {}) +// eth_getBlockByNumber("latest", false) // returns the latest block object. // // eth_subscribe("newHeads") @@ -40,7 +40,11 @@ type Block struct { func ExampleClientSubscription() { // Connect the client. - client, _ := rpc.Dial("ws://127.0.0.1:8545") + client, err := rpc.Dial("ws://127.0.0.1:8545") + if err != nil { + fmt.Println("dial error:", err) + return + } subch := make(chan Block) // Ensure that subch receives the latest block.