It doesn't add anything useful to regular Go types and actually native types
are always better to use in the Client. Especially given that this type is
not used by any code outside of the Client itself.
We've got parameters here and usually we name them Raw when they're
represented by json.RawMessage which is not the case here, so make it a bit
more friendly (the type itself is only used in client internals, so rename is
not a huge problem).
It's absolutely irrelevant for the client and request/response packages should
only contain code that is useful on both sides of the conversation. It's OK
for client tests to reuse this code, but the package is used by external
developers and they shouldn't be bothered with it. Nothing changed
functionally here except WSClient simplification. Fixes#2236.
Although it's the caller's duty to avoid WSClient re-closing, we
still can handle it.
Fixes the following neofs-node error:
```
panic: close of closed channel
goroutine 98 [running]:
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).Close(...)
github.com/nspcc-dev/neo-go@v0.98.3-pre.0.20220321144433-3b639f518ebb/pkg/rpc/client/wsclient.go:120
github.com/nspcc-dev/neofs-node/pkg/morph/subscriber.(*subscriber).Close(0x13)
github.com/nspcc-dev/neofs-node/pkg/morph/subscriber/subscriber.go:108 +0x29
github.com/nspcc-dev/neofs-node/pkg/morph/event.listener.Stop(...)
github.com/nspcc-dev/neofs-node/pkg/morph/event/listener.go:573
created by github.com/nspcc-dev/neofs-node/pkg/innerring.(*Server).Stop
github.com/nspcc-dev/neofs-node/pkg/innerring/innerring.go:285 +0x12f
```
Fix the following linter warning:
```
pkg/rpc/client/wsclient.go:99:18 govet copylocks: literal copies lock value from *cl: github.com/nspcc-dev/neo-go/pkg/rpc/client.Client contains sync.RWMutex
```
1. Keep initDone check only for the places where cache is directly accessed.
We don't need to check it in other places, otherwise we have a mess of
duplicating checks.
2. Fix bug in code related to block deserialisation. There's no magic, so
checking that initialisation is done is not enough for proper block
deserialisation. We need to manually fill StateRootEnabled field.
3. Since transaction doesn't need network magic to compute its hash, we don't
need to perform Client initialisation before transaction-related requests.
4. Check that cache is initialised before accessing network magic.
5. Refactor the way Policy contract hash is fetched for Client requests.
We don't really need Client initialisation for that, it's OK to fetch Policy
hash on-the-fly.
It's not network-tied any more, network is only needed to
sign/verify. Unfortunately we still have to keep network in consensus data
structures because of dbft library interface.
We make it explicit in the appropriate Block/Transaction structures, not via a
singleton as C# node does. I think this approach has a bit more potential and
allows better packages reuse for different purposes.