mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
Merge 10cd54e924 into 80f7c6c299
This commit is contained in:
commit
49928d3898
1 changed files with 34 additions and 28 deletions
|
|
@ -163,6 +163,8 @@ func parseRequest(incomingMsg json.RawMessage) ([]rpcRequest, bool, Error) {
|
||||||
return nil, false, &invalidMessageError{err.Error()}
|
return nil, false, &invalidMessageError{err.Error()}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// shh_subscribe should not be handled in a special way
|
||||||
|
if !strings.HasPrefix(in.Method, "shh_") {
|
||||||
// subscribe are special, they will always use `subscribeMethod` as first param in the payload
|
// subscribe are special, they will always use `subscribeMethod` as first param in the payload
|
||||||
if strings.HasSuffix(in.Method, subscribeMethodSuffix) {
|
if strings.HasSuffix(in.Method, subscribeMethodSuffix) {
|
||||||
reqs := []rpcRequest{{id: &in.Id, isPubSub: true}}
|
reqs := []rpcRequest{{id: &in.Id, isPubSub: true}}
|
||||||
|
|
@ -180,6 +182,7 @@ func parseRequest(incomingMsg json.RawMessage) ([]rpcRequest, bool, Error) {
|
||||||
}
|
}
|
||||||
return nil, false, &invalidRequestError{"Unable to parse subscription request"}
|
return nil, false, &invalidRequestError{"Unable to parse subscription request"}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasSuffix(in.Method, unsubscribeMethodSuffix) {
|
if strings.HasSuffix(in.Method, unsubscribeMethodSuffix) {
|
||||||
return []rpcRequest{{id: &in.Id, isPubSub: true,
|
return []rpcRequest{{id: &in.Id, isPubSub: true,
|
||||||
|
|
@ -215,6 +218,8 @@ func parseBatchRequest(incomingMsg json.RawMessage) ([]rpcRequest, bool, Error)
|
||||||
|
|
||||||
id := &in[i].Id
|
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
|
// subscribe are special, they will always use `subscriptionMethod` as first param in the payload
|
||||||
if strings.HasSuffix(r.Method, subscribeMethodSuffix) {
|
if strings.HasSuffix(r.Method, subscribeMethodSuffix) {
|
||||||
requests[i] = rpcRequest{id: id, isPubSub: true}
|
requests[i] = rpcRequest{id: id, isPubSub: true}
|
||||||
|
|
@ -233,6 +238,7 @@ func parseBatchRequest(incomingMsg json.RawMessage) ([]rpcRequest, bool, Error)
|
||||||
|
|
||||||
return nil, true, &invalidRequestError{"Unable to parse (un)subscribe request arguments"}
|
return nil, true, &invalidRequestError{"Unable to parse (un)subscribe request arguments"}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasSuffix(r.Method, unsubscribeMethodSuffix) {
|
if strings.HasSuffix(r.Method, unsubscribeMethodSuffix) {
|
||||||
requests[i] = rpcRequest{id: id, isPubSub: true, method: r.Method, params: r.Payload}
|
requests[i] = rpcRequest{id: id, isPubSub: true, method: r.Method, params: r.Payload}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue