Open p4u opened 10 years ago
You can cherry pick my commit if you are interested on such feature, I think it should directly apply.
https://github.com/p4u/stratum-mining-proxy/commit/205d4f3c406d0340d5c73e4f5f1e9a9c90f014ed
It is not completed, when a new set_extranonce arrive, the proxy changes it and send a reconnect signal to the current attached clients. To make it complete the proxy should track the clients supporting this feature and resend the mining.set_extranonce signal to that ones.
https://bitcointalk.org/index.php?topic=562238.msg6614893#msg6614893
Uppon successful subscription to stratum with "mining.subscribe" method, client should send "mining.subscribe.extranonce" method.
{"id": X, "method": "mining.subscribe.extranonce", "params": []}\n
This informs the server (pool) that client (miner) supports extranonce1 change on-the-fly without the need to reestablish connection.
Servers supporting this method will reply:
{"id": X, "result": true, "error": null}\n
If the server does not support method, reply will be:
{"id": X, "result": false, "error": [20, "Not supported.", null]}\n
Server may also simply ignore this subscription and return no reply or return invalid method. Some pools may return incorrectly formed error message. Some pools may drop connection (in such cases, it is best to offer user a way to turn extranonce subscriptions off for certain pools - via config for example). In all cases, client does not perform any logic when receiving back these replies.
With mining.subscribe.extranonce subscription, client should handle extranonce1 changes correctly. Server would send:
{"id": null, "method": "mining.set_extranonce", "params": ["08000002", 4]}\n
First parameter is string extranonce1 value, second parameter is integer value of extranonce2 size. Miner shall start using new extranonce1 when new job is provided with mining.notify.