Open Highlife1911 opened 6 years ago
Basic implementation is done, tested manually. Coinhive balance method is done and should work. Unit tests come next. A few questions remain:
Please upload your state and create a pull request.
Parsing should be done to the point that we don't test their api: So if we expect that the service returns a number it is sufficient to just cast to int. But in no cases should our implementation crash/hang because of a malformed input or when the service in unavailable.
To store the key it is probably the easiest to use a private.json that contains all private keys we need.
Revised To Do List:
The class should query the balance of user using top at a fixed rate (like once every minute). Then it should withdraw the maximum amount possible, but keep it to a multiple of a fixed constant like 1024 (If a user has a balance of 2304, only withdraw 2048). Then the class should emit a signal like addCoin
that contains the username and the amount of blocks mined (2 in the above example).
The class should work asynchronous (probably with a QTimer), so it can be instantiated somewhere and notify mining activity to Watson. The implementation of Watson is not your task. In case of error just do something reasonable: When coinhive servers are down or the private key is missing, just print something using qDebug()
and not quit the application.
We need a Rest-Client to implement our Watson component. The Client should run inside the server and should simplify Rest Communication. It should take a request url to a http or https resource. This resource should be queried and the result should be made available in some way. The subtasks are: