diff --git a/api/dapp.go b/api/dapp.go index db8e9b7..5f48b18 100644 --- a/api/dapp.go +++ b/api/dapp.go @@ -59,7 +59,8 @@ func (a *DAppApi) SendEthereumTransaction(value, to, data string) (string, error ethTx := resp.Msg.SendEthereumTransaction if ethTx == nil { - resp.Closer <- errors.New("got nil response") + resp.Closer <- errors.New("got nil ethTx response") + return "", errors.New("got nil ethTx response") } objTx := map[string]interface{}{ @@ -83,6 +84,8 @@ func (a *DAppApi) SendEthereumTransaction(value, to, data string) (string, error return "", err } + // Since closer is not passed further, we need to close it here to prevent timeout. + resp.Closer <- nil return string(raw), nil } diff --git a/mobile_interface.go b/mobile_interface.go index c76b315..dd5d22c 100644 --- a/mobile_interface.go +++ b/mobile_interface.go @@ -193,8 +193,13 @@ func SendResponse(id string, data string, responseError string, timeout int) err return errors.New("you have to start panthalassa") } + dataBytes, decodingError := base64.StdEncoding.DecodeString(data) + if decodingError != nil { + return decodingError + } + resp := &apiPB.Response{} - if err := proto.Unmarshal([]byte(data), resp); err != nil { + if err := proto.Unmarshal(dataBytes, resp); err != nil { return err }