rpc/server: be more specific in some sendrawtransaction error cases

Refs. #1894.
This commit is contained in:
Roman Khimov 2021-04-10 00:31:42 +03:00
parent 973ed8c1f6
commit 274f2c0408

View file

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