From 03b8c6841be08f19db0f98cea6d0a6f4fd64736f Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 19 Feb 2015 11:49:58 +0100 Subject: [PATCH] Topics => Topic. Closes #343 --- rpc/args.go | 2 +- rpc/message.go | 17 +---------------- rpc/packages.go | 10 +++++----- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/rpc/args.go b/rpc/args.go index 429b385d54..f730819fd9 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -289,7 +289,7 @@ type WhisperMessageArgs struct { Payload string To string From string - Topics []string + Topic []string Priority uint32 Ttl uint32 } diff --git a/rpc/message.go b/rpc/message.go index b5b852f544..d96c35d7e6 100644 --- a/rpc/message.go +++ b/rpc/message.go @@ -231,21 +231,6 @@ func (req *RpcRequest) ToFilterStringArgs() (string, error) { return args, nil } -func (req *RpcRequest) ToFilterChangedArgs() (int, error) { - if len(req.Params) < 1 { - return 0, NewErrorResponse(ErrorArguments) - } - - var id int - r := bytes.NewReader(req.Params[0]) - err := json.NewDecoder(r).Decode(&id) - if err != nil { - return 0, NewErrorResponse(ErrorDecodeArgs) - } - rpclogger.DebugDetailf("%T %v", id, id) - return id, nil -} - func (req *RpcRequest) ToDbPutArgs() (*DbArgs, error) { if len(req.Params) < 3 { return nil, NewErrorResponse(ErrorArguments) @@ -301,7 +286,7 @@ func (req *RpcRequest) ToWhisperFilterArgs() (*xeth.Options, error) { return &args, nil } -func (req *RpcRequest) ToWhisperIdArgs() (int, error) { +func (req *RpcRequest) ToIdArgs() (int, error) { if len(req.Params) < 1 { return 0, NewErrorResponse(ErrorArguments) } diff --git a/rpc/packages.go b/rpc/packages.go index 8aa604aa55..7044d9d127 100644 --- a/rpc/packages.go +++ b/rpc/packages.go @@ -349,7 +349,7 @@ func (self *EthereumApi) MessagesChanged(id int, reply *interface{}) error { } func (p *EthereumApi) WhisperPost(args *WhisperMessageArgs, reply *interface{}) error { - err := p.xeth.Whisper().Post(args.Payload, args.To, args.From, args.Topics, args.Priority, args.Ttl) + err := p.xeth.Whisper().Post(args.Payload, args.To, args.From, args.Topic, args.Priority, args.Ttl) if err != nil { return err } @@ -445,13 +445,13 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error } return p.NewFilterString(args, reply) case "eth_changed": - args, err := req.ToFilterChangedArgs() + args, err := req.ToIdArgs() if err != nil { return err } return p.FilterChanged(args, reply) case "eth_filterLogs": - args, err := req.ToFilterChangedArgs() + args, err := req.ToIdArgs() if err != nil { return err } @@ -504,7 +504,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error } return p.NewWhisperFilter(args, reply) case "shh_changed": - args, err := req.ToWhisperIdArgs() + args, err := req.ToIdArgs() if err != nil { return err } @@ -522,7 +522,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error } return p.HasWhisperIdentity(args, reply) case "shh_getMessages": - args, err := req.ToWhisperIdArgs() + args, err := req.ToIdArgs() if err != nil { return err }