From 17ea6411a24bd76e9b0cd4c4cd8e886bb0863181 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 2 Jul 2020 16:00:07 +0300 Subject: [PATCH] rpc/client: ensure compatibility with preview2 C# node for invoke* It won't work with proper cosigners and the client must be compatible both with neo-go and C# node. See neo/neo-modules#260 also. --- pkg/rpc/client/rpc.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/rpc/client/rpc.go b/pkg/rpc/client/rpc.go index f19fdd83e..f41bf38eb 100644 --- a/pkg/rpc/client/rpc.go +++ b/pkg/rpc/client/rpc.go @@ -369,6 +369,18 @@ func (c *Client) invokeSomething(method string, p request.RawParams, cosigners [ p.Values = append(p.Values, cosigners) } if err := c.performRequest(method, p, resp); err != nil { + // Retry with old-fashioned hashes (see neo/neo-modules#260). + if cosigners != nil { + var hashes = make([]util.Uint160, len(cosigners)) + for i := range cosigners { + hashes[i] = cosigners[i].Account + } + p.Values[len(p.Values)-1] = hashes + err = c.performRequest(method, p, resp) + if err == nil { + return resp, nil + } + } return nil, err } return resp, nil