fibercrypto / fibercrypto/skywallet-daemon

Error when calling /intermediate/button multiple times

Open
#107 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### Context:

The `/intermediate/button` API endpoint can be called several times and, in theory, the last call should get a valid answer after the user presses a button in the device. For example, After calling the `/backup` endpoint and then calling the `/intermediate/button` endpoint, it is possible to cancel the call to `/intermediate/button` and the call that same endpoint again for getting a response after the user presses a button in the device.

### Problem:

The previous example fails randomly, because after the user presses a button in the device the correct answer is not returned to the last call to `/intermediate/button`, but it can be sent to any of the previous calls to `/intermediate/button` (randomly selected).

### Example test:

I used the app Postman to call the `/backup` API endpoint, and, after that, the `/intermediate/button` endpoint (as should normally be done) After that, I cancelled the request to `/intermediate/button` and called that same endpoint again, I did that 8 times before pressing a button in the hw wallet. Fiddler showed this:

![f1](https://user-images.githubusercontent.com/34079003/62813400-8e9f0800-bad8-11e9-9b6e-e3a39f9cebfe.png)

The image shows the first call to `/backup` and 8 calls to `/intermediate/button`. All the last 8 connections show a green arrow because the system is still waiting for a response from the daemon, although the connections were canceled in Postman. The same behavior happens when cancelling a request made with a web browser, and also when cancelling requests to a Skycoin node, so it appears to be normal a behavior.

After that, I pressed a button in the hw wallet and the last call to `/intermediate/button` got this response:

```
{
"error": {
"message": "closed device",
"code": 500
}
}
```

However, the interesting part is that Fiddler showed this:

![f2](https://user-images.githubusercontent.com/34079003/62813403-965eac80-bad8-11e9-90a9-728cfae4f278.png)

The correct answer was received by the fifth call to `/intermediate/button` (in other tests the correct answer was received by other request, so the result appears to be random). The image shows the same icon for the first 7 calls because the response was ignored by the client (because the request was cancelled), but the fifth call has a status code 200.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.