From 274f2c04087d5aaf585eaf05dfc17b0528b3ffcb Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Sat, 10 Apr 2021 00:31:42 +0300 Subject: [PATCH] rpc/server: be more specific in some sendrawtransaction error cases Refs. #1894. --- 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 93356c421..2a64d1383 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -1419,15 +1419,15 @@ func (s *Server) submitOracleResponse(ps request.Params) (interface{}, *response func (s *Server) sendrawtransaction(reqParams request.Params) (interface{}, *response.Error) { if len(reqParams) < 1 { - return nil, response.ErrInvalidParams + return nil, response.NewInvalidParamsError("not enough parameters", nil) } byteTx, err := reqParams[0].GetBytesBase64() if err != nil { - return nil, response.ErrInvalidParams + return nil, response.NewInvalidParamsError("not base64", err) } tx, err := transaction.NewTransactionFromBytes(byteTx) if err != nil { - return nil, response.ErrInvalidParams + return nil, response.NewInvalidParamsError("can't decode transaction", err) } return getRelayResult(s.coreServer.RelayTxn(tx), tx.Hash()) }