Skip to content

Conversation

@epineapple
Copy link

@epineapple epineapple commented Feb 26, 2020

This collection of changes allows the prosper-miner to run as a Windows service (and hopefully a *NIX daemon soon.) This change adds the following commands to the executable:

  • service: install, uninstall, start and stop the service
  • rpc: control and query the service using JSON-RPC over a named-pipe
  • feed: print notifications from the service when a share is submitted and regular notifications of the hash rate

This PR needs some work in the following areas:

  • the service and the original miner use different code for reading configuration files
  • the service does not yet work on non-Windows platforms
  • the service currently depends on Add InitWithPath pegnet/LXRHash#71, which has not been merged
  • the service does not yet support lxr.HashParallel because of some unanswered questions
  • the service does not yet handle registration using an invite code

I'm opening this PR so the appropriate people can start reviewing and asking questions.

This PR is built on the changes submitted in #61.

This command allows for the collection of statistics at any time,
instead of waiting until submitting results.
Add notification channels for the current hash rate and for submissions.
This goroutine and these notification channels allow programs to provide
users with current statistics.
If `InitMiners` has not completed (because LXRHash is building the 1GB
table file) and the `ReportHashRate` timer is triggered, the
`SendCommand` call dereferences a null pointer.  (It might be a good
idea to add a check in `SendCommand`.)  This change defers starting the
`ReportHashRate` goroutine until the end of `InitMiners`.
Add the "startfeed" and "stopfeed" commands. The feed will print a
message when a share is submitted and print the current hash rate at
regular intervals.
891ff3a fixed a crash by moving a goroutine.  This change fixes
that fix by putting the goroutine outside of the loop.
This call duplicates a call made in client.Listen, which calls
client.Close when the context is cancelled.
This change, which has only been tested on Windows 10, adds a Windows
service (eventually also a *NIX/macOS daemon.)  The newly-added service
command can start, stop, install and uninstall the service on Windows,
provided the account running the command has sufficient privileges.
This service has a JSON-RPC server which listens on a named pipe.  The
change also adds the rpc and feed commands, which can control and query
the state of the miner service.
Prior to this change, subscriptions only delivered each event to one
client, generally in a round-robin fashion.  This change ensures that
each event is delivered to all clients.

Add status subscriptions.  As of this commit, subscribed clients receive
notifications for connection to and disconnection from the pool.
This call duplicates a call that happens when the context is cancelled
and resulted in freeing a semaphore twice.
Add the selectConfigFile which handles finding the proper config file by
priority.  Add tests for selectConfigFile.
@epineapple
Copy link
Author

I've verified that the service works on macOS, x86_64 and arm64 linux in addition to x86_64 Windows. The missing feature has been merged to LXRHash. I'm currently working on merging the configuration code used by the service and the foreground process.

Last week I documented the protocol that prosper-miner speaks to controlling processes. I've documented but not implemented a flow for registration via the GUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant