// DeferToBtcd sends a marshaled JSON-RPC request to btcd and returns // the reply. func DeferToBtcd(cmd btcjson.Cmd) (interface{}, *btcjson.Error) { // Update cmd with a new ID so replies can be handled without frontend // IDs clashing with requests originating in btcwallet. The original // request ID is always used in the frontend's response. cmd.SetId(<-NewJSONID) request := NewRPCRequest(cmd, nil) response := <-CurrentRPCConn().SendRequest(request) return response.Result, response.Err }