mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
rpc: use custom struct instead
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
26e0264219
commit
416485400c
1 changed files with 7 additions and 3 deletions
|
|
@ -177,13 +177,17 @@ func (n *Notifier) activate() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Notifier) send(sub *Subscription, data interface{}) error {
|
func (n *Notifier) send(sub *Subscription, data interface{}) error {
|
||||||
params, _ := json.Marshal(struct {
|
params := struct {
|
||||||
ID string `json:"subscription"`
|
ID string `json:"subscription"`
|
||||||
Result interface{} `json:"result,omitempty"`
|
Result interface{} `json:"result,omitempty"`
|
||||||
}{ID: string(sub.ID), Result: data})
|
}{ID: string(sub.ID), Result: data}
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
msg := &jsonrpcMessage{
|
msg := struct {
|
||||||
|
Version string `json:"jsonrpc,omitempty"`
|
||||||
|
Method string `json:"method,omitempty"`
|
||||||
|
Params interface{} `json:"params,omitempty"`
|
||||||
|
}{
|
||||||
Version: vsn,
|
Version: vsn,
|
||||||
Method: n.namespace + notificationMethodSuffix,
|
Method: n.namespace + notificationMethodSuffix,
|
||||||
Params: params,
|
Params: params,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue