mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-24 09:25:21 +00:00
rpc/server: be more specific in some sendrawtransaction error cases
Refs. #1894.
This commit is contained in:
parent
973ed8c1f6
commit
274f2c0408
1 changed files with 3 additions and 3 deletions
|
@ -1419,15 +1419,15 @@ func (s *Server) submitOracleResponse(ps request.Params) (interface{}, *response
|
||||||
|
|
||||||
func (s *Server) sendrawtransaction(reqParams request.Params) (interface{}, *response.Error) {
|
func (s *Server) sendrawtransaction(reqParams request.Params) (interface{}, *response.Error) {
|
||||||
if len(reqParams) < 1 {
|
if len(reqParams) < 1 {
|
||||||
return nil, response.ErrInvalidParams
|
return nil, response.NewInvalidParamsError("not enough parameters", nil)
|
||||||
}
|
}
|
||||||
byteTx, err := reqParams[0].GetBytesBase64()
|
byteTx, err := reqParams[0].GetBytesBase64()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, response.ErrInvalidParams
|
return nil, response.NewInvalidParamsError("not base64", err)
|
||||||
}
|
}
|
||||||
tx, err := transaction.NewTransactionFromBytes(byteTx)
|
tx, err := transaction.NewTransactionFromBytes(byteTx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, response.ErrInvalidParams
|
return nil, response.NewInvalidParamsError("can't decode transaction", err)
|
||||||
}
|
}
|
||||||
return getRelayResult(s.coreServer.RelayTxn(tx), tx.Hash())
|
return getRelayResult(s.coreServer.RelayTxn(tx), tx.Hash())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue