slush0 / stratum

Stratum server implementation using Python Twisted
Other
88 stars 131 forks source link

Add new method "mining.ping" #16

Open p4u opened 10 years ago

p4u commented 10 years ago

When using multiple pools, it would be useful to add a new ping method for the stratum protocol. So the worker does not need to wait until the timeout or the TCP connection lost event. It can send pings periodically, wait some seconds for the reply and if not change to the second pool.

Client: {"params": [], "id": 4, "method": "ping"}

Server: {"error": null, "id": 4, "result": true}

If the pool is sending new jobs often (every few seconds) this method is not needed, but in case the pool is sending jobs or changing difficulty not so often (depends on the coin, the block generation time, etc.), then this method might increase the performance of many workers by not spending time waiting for a pool timeout.