From 55fb221bbb9c6ab65915a6406c99e304955a6c25 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 15 Oct 2021 07:01:47 +0300 Subject: [PATCH] rpc: make `getproof` work with destroyed contracts Now it's able to get proof for destroyed contract if the contract wasn't destroyed before the requested stateroot's height. --- pkg/rpc/server/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index ab9ac6ce1..fe7c06487 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -991,9 +991,9 @@ func (s *Server) getProof(ps request.Params) (interface{}, *response.Error) { if err != nil { return nil, response.ErrInvalidParams } - cs := s.chain.GetContractState(sc) - if cs == nil { - return nil, response.ErrInvalidParams + cs, respErr := s.getHistoricalContractState(root, sc) + if respErr != nil { + return nil, respErr } skey := makeStorageKey(cs.ID, key) proof, err := s.chain.GetStateModule().GetStateProof(root, skey)