Clean up interface pointer ID handling.

This commit is contained in:
Josh Rickmar 2014-06-27 16:05:01 -05:00
parent 6909e0dc68
commit 2a006cc83a

View file

@ -785,12 +785,12 @@ func (s *rpcServer) PostClientRPC(w http.ResponseWriter, r *http.Request) {
// Parse the full request since it must be handled by wallet. // Parse the full request since it must be handled by wallet.
cmd, err := btcjson.ParseMarshaledCmd(rpcRequest) cmd, err := btcjson.ParseMarshaledCmd(rpcRequest)
var id interface{} var idPtr *interface{}
if cmd != nil { if cmd != nil {
id = cmd.Id() idPtr = idPointer(cmd.Id())
} }
if err != nil { if err != nil {
_, err := w.Write(marshalError(idPointer(cmd.Id()))) _, err := w.Write(marshalError(idPtr))
if err != nil { if err != nil {
log.Warnf("Client sent invalid request but unable "+ log.Warnf("Client sent invalid request but unable "+
"to respond with error: %v", err) "to respond with error: %v", err)
@ -821,7 +821,7 @@ func (s *rpcServer) PostClientRPC(w http.ResponseWriter, r *http.Request) {
return return
} }
resp := btcjson.Reply{ resp := btcjson.Reply{
Id: idPointer(id), Id: idPtr,
Result: response.result, Result: response.result,
Error: response.jsonErr, Error: response.jsonErr,
} }