i just edited and it works with other pools
client_service.py
def handle_event(self, method, params, connection_ref):
'''Handle RPC calls and notifications from the pool'''
# Yay, we received something from the pool,
# let's restart the timeout.
self.reset_timeout()
if method == 'job':
'''Proxy just received information about new mining job'''
if 'id' in params:
(blob, job_id, target, user_id) = params["blob"],params["job_id"],params["target"],params["id"]
# Broadcast to Stratum client
stratum_listener.MiningSubscription.on_template(job_id, blob, target, user_id)
# Broadcast to getwork clients
job = Job.build_from_pool(job_id, blob, target)
log.info("New job %s for %s" % (job_id, user_id))
self.job_registry.add_job(job, True)
else:
(blob, job_id, target) = params["blob"],params["job_id"],params["target"]
stratum_listener.MiningSubscription.on_template_all(job_id, blob, target)
job = Job.build_from_pool(job_id, blob, target)
log.info("New job %s for all" % (job_id))
self.job_registry.add_job(job, True)
else:
'''Pool just asked us for something which we don't support...'''
log.error("Unhandled method %s with params %s" % (method, params))
stratum_listener.py
@classmethod
def on_template(cls, job_id, blob, target, user_id):
'''Push new job to subscribed clients'''
#cls.last_broadcast = (job_id, blob, target)
#if user_id:
# cls.user_id = user_id
if cls.subscribers.has_key(user_id):
subscr = cls.subscribers[user_id]
subscr.emit_single({'job_id':job_id, 'blob':blob, 'target':target})
@classmethod
def on_template_all(cls, job_id, blob, target):
for subs in cls.subscribers:
try:
subscr = cls.subscribers[subs]
subscr.emit_single({'job_id':job_id, 'blob':blob, 'target':target})
except Exception:
pass
but many invalid job_id
{"id":19,"jsonrpc":"2.0","error":{"code":-1,"message":"Invalid job id"}}
not sure why i dont know python very well
packet logs:
{"jsonrpc": "2.0", "params": {"login": "437CToWfQb5HFFraTPhaS8ZfTthUwLdGgPHrciV9uWaS1jivf6r****PnhckPD", "agent": "proxy", "pass": "1"}, "id": 1, "method": "login"}
{"id":1,"jsonrpc":"2.0","error":null,"result":{"id":"560139597905799","job":{"blob":"01009ed5b99f058b1f02b11e7d4dcac5ef8d5f2ac434727a38c9b7055ce59d59d08451f0b9fa4d0
0000000ed5eb0d5b5e8bef1970ff0e8ff6232341225c0c4a275e074aa85da2f7219570801","job_id":"544189373659901","target":"f6bc0800"},"status":"OK"}}
{"jsonrpc": "2.0", "params": {"login": "437CToWfQb5HFFraTPhaS8ZfTthUwLdGgPHrciV9uWaS1jivf6r****PnhckPD", "pass": "1"}, "id": 2, "method": "login"}
{"id":2,"jsonrpc":"2.0","error":null,"result":{"id":"254695240897126","job":{"blob":"01009ed5b99f058b1f02b11e7d4dcac5ef8d5f2ac434727a38c9b7055ce59d59d08451f0b9fa4d0
00000004f7c1e80eb27f4d27b2b6c3120b8173c7778e6cf3cee976b1628bd800e70d27b01","job_id":"434091379633173","target":"f6bc0800"},"status":"OK"}}
{"jsonrpc": "2.0", "params": {"nonce": "d3030000", "result": "c6146f8dc56967a2f17f2bd6c995bcc0bc8814a82451e1d9facc09aa68e80100", "id": "254695240897126", "job_id": "434091379633173"}, "id": 3, "method": "submit"}
{"id":3,"jsonrpc":"2.0","error":null,"result":{"status":"OK"}}
{"jsonrpc": "2.0", "params": {"login": "437CToWfQb5HFFraTPhaS8ZfTthUwLdGgPHrciV9uWaS1jivf6r****PnhckPD", "pass": "1"}, "id": 4, "method": "login"}
{"jsonrpc": "2.0", "params": {"login": "437CToWfQb5HFFraTPhaS8ZfTthUwLdGgPHrciV9uWaS1jivf6r****PnhckPD", "pass": "1"}, "id": 5, "method": "login"}
{"id":4,"jsonrpc":"2.0","error":null,"result":{"id":"318788292887620","job":{"blob":"01009ed5b99f058b1f02b11e7d4dcac5ef8d5f2ac434727a38c9b7055ce59d59d08451f0b9fa4d0
0000000bb9d5264e33dca797d5cc076d36f7312c2668a8918014b00c95886c3cf569e0b01","job_id":"329343325784429","target":"f6bc0800"},"status":"OK"}}
{"id":5,"jsonrpc":"2.0","error":null,"result":{"id":"531188863515853","job":{"blob":"01009ed5b99f058b1f02b11e7d4dcac5ef8d5f2ac434727a38c9b7055ce59d59d08451f0b9fa4d0
0000000510959c650a7d9e264ad669f6fd8406e90cefcafe87efac62d7c9ee082bb3f9301","job_id":"420845326664857","target":"f6bc0800"},"status":"OK"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"01009bd7b99f05d4f387598be1bac5ed947ea47c9a0aee0bace4ac84f7cf40c321e0d78e3c01080
000000075fa367d49fc5499789bf9dd90a2905ba9af403f505c616cbf4a25a53138257308","job_id":"480231605377048","target":"f6bc0800"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"01009bd7b99f05d4f387598be1bac5ed947ea47c9a0aee0bace4ac84f7cf40c321e0d78e3c01080
00000000b739358ffe4e43ed0c29665ce1aaac5cf2cf74dec4435abb7a452cf561e21d408","job_id":"308798798942007","target":"f6bc0800"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"01009bd7b99f05d4f387598be1bac5ed947ea47c9a0aee0bace4ac84f7cf40c321e0d78e3c01080
0000000f2c67f46b3cef2d5595731522af860fafce340d548d4d1628c987d02b64107ec08","job_id":"132683923211880","target":"f6bc0800"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"01009bd7b99f05d4f387598be1bac5ed947ea47c9a0aee0bace4ac84f7cf40c321e0d78e3c01080
00000006811f7c72abb962371f7337cbc65ca76d8e0ed8b807a1f735a4ce94fd8ec319708","job_id":"906486337329261","target":"f6bc0800"}}
{"jsonrpc": "2.0", "params": {"nonce": "92030000", "result": "e4ab04f8efda48353fb9b6f65438f0f1b5597ee4f3ccfa6c98a1b79290f70500", "id": "318788292887620", "job_id": "906486337329261"}, "id": 6, "method": "submit"}
{"id":6,"jsonrpc":"2.0","error":{"code":-1,"message":"Invalid job id"}}