From 21ccb1a02a65c458df093d51fa91de5fb13cf4d5 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 8 Dec 2023 21:56:09 +0300 Subject: [PATCH] rpcclient: check network initialisation for blocks subscriptions StateRootInHeader depends on it, so we better immediately return error if client is not initialised. Signed-off-by: Anna Shaleva --- pkg/rpcclient/wsclient.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/rpcclient/wsclient.go b/pkg/rpcclient/wsclient.go index b9e03f0f2..044214a73 100644 --- a/pkg/rpcclient/wsclient.go +++ b/pkg/rpcclient/wsclient.go @@ -732,6 +732,9 @@ func (c *WSClient) ReceiveBlocks(flt *neorpc.BlockFilter, rcvr chan<- *block.Blo if rcvr == nil { return "", ErrNilNotificationReceiver } + if !c.cache.initDone { + return "", errNetworkNotInitialized + } params := []any{"block_added"} if flt != nil { flt = flt.Copy()