Disable function send transaction with rpc

This commit is contained in:
Nguyen Ba Tam 2018-08-22 16:56:22 +07:00
parent 30e91ddbde
commit 6d1ee2e99c

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 a single shot request is executing, run and return immediately
if singleShot { if singleShot {
if batch { 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) s.execBatch(ctx, codec, reqs)
} else { } 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]) s.exec(ctx, codec, reqs[0])
} }
return nil return nil