mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
shh: fix shh_subscribe request parsing for batch requests in jsonrpc api (#14450)
This commit is contained in:
parent
1f6cec8924
commit
10cd54e924
1 changed files with 17 additions and 14 deletions
|
|
@ -218,6 +218,8 @@ func parseBatchRequest(incomingMsg json.RawMessage) ([]rpcRequest, bool, Error)
|
|||
|
||||
id := &in[i].Id
|
||||
|
||||
// shh_subscribe should not be handled in a special way
|
||||
if !strings.HasPrefix(r.Method, "shh_") {
|
||||
// subscribe are special, they will always use `subscriptionMethod` as first param in the payload
|
||||
if strings.HasSuffix(r.Method, subscribeMethodSuffix) {
|
||||
requests[i] = rpcRequest{id: id, isPubSub: true}
|
||||
|
|
@ -236,6 +238,7 @@ func parseBatchRequest(incomingMsg json.RawMessage) ([]rpcRequest, bool, Error)
|
|||
|
||||
return nil, true, &invalidRequestError{"Unable to parse (un)subscribe request arguments"}
|
||||
}
|
||||
}
|
||||
|
||||
if strings.HasSuffix(r.Method, unsubscribeMethodSuffix) {
|
||||
requests[i] = rpcRequest{id: id, isPubSub: true, method: r.Method, params: r.Payload}
|
||||
|
|
|
|||
Loading…
Reference in a new issue