rpc: fix getrawtransaction error returncode

Changed returncode of getrowtransaction method in case when transaction
with specified hash does not exists. Now it returns error with code -100
instead of -32602 (as in c# node)
This commit is contained in:
Anna Shaleva 2020-02-15 19:14:05 +03:00 committed by AnnaShaleva
parent 5dca765bd1
commit f310145612

View file

@ -288,7 +288,7 @@ func (s *Server) getrawtransaction(reqParams Params) (interface{}, error) {
resultsErr = errInvalidParams resultsErr = errInvalidParams
} else if tx, height, err := s.chain.GetTransaction(txHash); err != nil { } else if tx, height, err := s.chain.GetTransaction(txHash); err != nil {
err = errors.Wrapf(err, "Invalid transaction hash: %s", txHash) err = errors.Wrapf(err, "Invalid transaction hash: %s", txHash)
return nil, NewInvalidParamsError(err.Error(), err) return nil, NewRPCError("Unknown transaction", err.Error(), err)
} else if len(reqParams) >= 2 { } else if len(reqParams) >= 2 {
_header := s.chain.GetHeaderHash(int(height)) _header := s.chain.GetHeaderHash(int(height))
header, err := s.chain.GetHeader(_header) header, err := s.chain.GetHeader(_header)