From d2f3929b512d951a614f72760d476430ff882f6a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 12 Oct 2022 14:20:46 +0400 Subject: [PATCH] [#349] client: Use `context.Background` in `Dial` by default Passing `nil` context to `rpc.Balance` leads to panic. To prevent panic, we need to provide some default context in `Dial`. Signed-off-by: Leonard Lyubich --- client/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/client.go b/client/client.go index 46c4fa3..bea46f6 100644 --- a/client/client.go +++ b/client/client.go @@ -105,6 +105,10 @@ func (c *Client) Dial(prm PrmDial) error { c.setNeoFSAPIServer((*coreServer)(&c.c)) + if prm.parentCtx == nil { + prm.parentCtx = context.Background() + } + // TODO: (neofs-api-go#382) perform generic dial stage of the client.Client _, err := rpc.Balance(&c.c, new(v2accounting.BalanceRequest), client.WithContext(prm.parentCtx),