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.
This commit is contained in:
Anna Shaleva 2021-10-15 07:01:47 +03:00
parent af9e39ced2
commit 55fb221bbb

View file

@ -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)