From d77f188d10cd1b408466776e98ed1ce8d0f1b4a2 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 22 Feb 2022 15:39:42 +0300 Subject: [PATCH] rpc: update native contract hashes inside (c *Client) GetNativeContracts() --- pkg/rpc/client/rpc.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/rpc/client/rpc.go b/pkg/rpc/client/rpc.go index 428cb30bb..3d035d40f 100644 --- a/pkg/rpc/client/rpc.go +++ b/pkg/rpc/client/rpc.go @@ -271,6 +271,14 @@ func (c *Client) GetNativeContracts() ([]state.NativeContract, error) { if err := c.performRequest("getnativecontracts", params, &resp); err != nil { return resp, err } + + // Update native contract hashes. + c.cacheLock.Lock() + for _, cs := range resp { + c.cache.nativeHashes[cs.Manifest.Name] = cs.Hash + } + c.cacheLock.Unlock() + return resp, nil }