mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
rpc: account for error responses in batch size limit
This commit is contained in:
parent
c2e1785a48
commit
c8cd8a129c
1 changed files with 5 additions and 0 deletions
|
|
@ -238,6 +238,11 @@ func (h *handler) handleBatch(msgs []*jsonrpcMessage) {
|
|||
callBuffer.pushResponse(resp)
|
||||
if resp != nil && h.batchResponseMaxSize != 0 {
|
||||
responseBytes += len(resp.Result)
|
||||
if resp.Error != nil {
|
||||
if errData, err := json.Marshal(resp.Error); err == nil {
|
||||
responseBytes += len(errData)
|
||||
}
|
||||
}
|
||||
if responseBytes > h.batchResponseMaxSize {
|
||||
err := &internalServerError{errcodeResponseTooLarge, errMsgResponseTooLarge}
|
||||
callBuffer.respondWithError(cp.ctx, h.conn, err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue