jtoomim / p2pool

Peer-to-peer Bitcoin mining pool
https://github.com/jtoomim/p2pool/
GNU General Public License v3.0
37 stars 45 forks source link

authorize should return true result to miner #20

Closed dfoderick closed 5 years ago

dfoderick commented 5 years ago

When miner authorizes to pool the pool returns a result to the miner. That result should be true if the miner is authorized.

kr1z1s commented 5 years ago

This module works through jsonrpc.py module!

Result return here - https://github.com/jtoomim/p2pool/blob/1mb_segwit/p2pool/util/jsonrpc.py#L96-L100

Enjoy :)

dfoderick commented 5 years ago

Correct. The return value from rpc_authorize will get sent to miner in that json message. The return value for authorize should be true or false (a boolean), not null (None in Python).

See https://en.bitcoin.it/wiki/Stratum_mining_protocol#mining.authorize "The result from an authorize request is usually true (successful), or false."

It is a nitpick issue to make p2pool more compliant with the stratum specification. Miner will continue to mine with any result but pool should return true from authorize if pool wants miner to mine so it is more correct to return true in this case.

kr1z1s commented 5 years ago

Correct. The return value from rpc_authorize will get sent to miner in that json message. The return value for authorize should be true or false (a boolean), not null (None in Python).

See https://en.bitcoin.it/wiki/Stratum_mining_protocol#mining.authorize "The result from an authorize request is usually true (successful), or false."

It is a nitpick issue to make p2pool more compliant with the stratum specification. Miner will continue to mine with any result but pool should return true from authorize if pool wants miner to mine so it is more correct to return true in this case.

Yes. You're right Here is logs without "return True" 2018-12-12 19:27:19.496739 {u'params': [u'ARMvPZSxdgw8thGEfqxy2M8bK6hj1VjkWC', u''], u'id': 2, u'method': u'mining.authorize'} 2018-12-12 19:27:19.496818 {"error": null, "jsonrpc": "2.0", "id": 2, "result": null}

And here is logs with "return True" 2018-12-12 19:31:23.915891 {u'params': [u'ARMvPZSxdgw8thGEfqxy2M8bK6hj1VjkWC', u''], u'id': 2, u'method': u'mining.authorize'} 2018-12-12 19:31:23.915987 {"error": null, "jsonrpc": "2.0", "id": 2, "result": true}

Protocol description from Slush - https://slushpool.com/help/manual/stratum-protocol

{"params": ["slush.miner1", "password"], "id": 2, "method": "mining.authorize"}\n {"error": null, "id": 2, "result": true}\n