mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: cancel context in testRequest
This commit is contained in:
parent
558a198602
commit
4a307160d5
2 changed files with 3 additions and 2 deletions
|
|
@ -326,7 +326,8 @@ func testRequest(ctx context.Context, t *testing.T, client *rpc.Client) bool {
|
||||||
var res string
|
var res string
|
||||||
var addr common.Address
|
var addr common.Address
|
||||||
rand.Read(addr[:])
|
rand.Read(addr[:])
|
||||||
c, _ := context.WithTimeout(ctx, time.Second*12)
|
c, cancel := context.WithTimeout(ctx, time.Second*12)
|
||||||
|
defer cancel()
|
||||||
err := client.CallContext(c, &res, "eth_getBalance", addr, "latest")
|
err := client.CallContext(c, &res, "eth_getBalance", addr, "latest")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Log("request error:", err)
|
t.Log("request error:", err)
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/hashicorp/golang-lru"
|
lru "github.com/hashicorp/golang-lru"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue