Merge pull request #155 from nguyenbatam/disable_func_send_transaction_with_rpc

Disable function send transaction with rpc
This commit is contained in:
Tuna 2018-08-29 11:53:32 +07:00 committed by GitHub
commit 7c55084785
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -189,8 +189,18 @@ func (s *Server) serveRequest(codec ServerCodec, singleShot bool, options CodecO
// If a single shot request is executing, run and return immediately
if singleShot {
if batch {
for _, req := range reqs {
if req.callb != nil && req.callb.method.Name == "SendTransaction" {
codec.Write(codec.CreateErrorResponse(&req.id, &invalidRequestError{message: "Only support send transaction with ipc"}))
return nil
}
}
s.execBatch(ctx, codec, reqs)
} else {
if reqs[0].callb != nil && reqs[0].callb.method.Name == "SendTransaction" {
codec.Write(codec.CreateErrorResponse(&reqs[0].id, &invalidRequestError{message: "Only support send transaction with ipc"}))
return nil
}
s.exec(ctx, codec, reqs[0])
}
return nil