Skip to content

Commit

Permalink
rpc/server: be more specific in some sendrawtransaction error cases
Browse files Browse the repository at this point in the history
Refs. #1894.
  • Loading branch information
roman-khimov authored and AnnaShaleva committed Apr 27, 2021
1 parent db2e16f commit 9cc08e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/rpc/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit 9cc08e3

Please sign in to comment.