mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
shh: fix shh_subscribe request parsing in jsonrpc api (#14450)
This commit is contained in:
parent
ef7b9fb7d0
commit
1f6cec8924
1 changed files with 17 additions and 14 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,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue