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))
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 == 'eth_getWork': '''Proxy just received information about new mining job''' # Broadcast to getwork clients job = Job.build_from_pool(params) self.job_registry.replace_job(job, connection_ref) else: '''Pool just asked us for something which we don't support...''' log.error("Unhandled method %s with params %s" % (method, params))
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''' (blob, job_id, target, user_id, height) = params["blob"],params["job_id"],params["target"],params["id"],params["height"] # Broadcast to Stratum client stratum_listener.MiningSubscription.on_template(job_id, blob, target, user_id, height) # Broadcast to getwork clients job = Job.build_from_pool(job_id, blob, target, height) log.info("New job %s for %s on height %s" % (job_id, user_id, height)) 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))