rpc: use base64 for submitblock and sendrawtransaction

Changes ported from https://github.com/neo-project/neo-modules/pull/394.
This commit is contained in:
Anna Shaleva 2020-11-12 14:05:20 +03:00
parent e700fb2c96
commit 20f8fe5699
5 changed files with 17 additions and 31 deletions

View file

@ -1075,7 +1075,7 @@ func (s *Server) runScriptInVM(script []byte, tx *transaction.Transaction) *resu
// submitBlock broadcasts a raw block over the NEO network.
func (s *Server) submitBlock(reqParams request.Params) (interface{}, *response.Error) {
blockBytes, err := reqParams.ValueWithType(0, request.StringT).GetBytesHex()
blockBytes, err := reqParams.ValueWithType(0, request.StringT).GetBytesBase64()
if err != nil {
return nil, response.ErrInvalidParams
}
@ -1105,7 +1105,7 @@ func (s *Server) sendrawtransaction(reqParams request.Params) (interface{}, *res
if len(reqParams) < 1 {
return nil, response.ErrInvalidParams
} else if byteTx, err := reqParams[0].GetBytesHex(); err != nil {
} else if byteTx, err := reqParams[0].GetBytesBase64(); err != nil {
return nil, response.ErrInvalidParams
} else {
tx, err := transaction.NewTransactionFromBytes(s.network, byteTx)