from stratum.pubsub import Pubsub, Subscription
from mining.interfaces import Interfaces
+from stratum import settings
import stratum.logger
log = stratum.logger.get_logger('subscription')
event = 'mining.notify'
@classmethod
- def on_block(cls, is_new_block):
+ def on_template(cls, is_new_block):
'''This is called when TemplateRegistry registers
new block which we have to broadcast clients.'''
return result
# Force set higher difficulty
- # TODO
- #self.connection_ref().rpc('mining.set_difficulty', [2,], is_notification=True)
+ self.connection_ref().rpc('mining.set_difficulty', [settings.POOL_TARGET,], is_notification=True)
#self.connection_ref().rpc('client.get_version', [])
# Force client to remove previous jobs if any (eg. from previous connection)
'''This will send new job to the client *after* he receive subscription details.
on_finish callback solve the issue that job is broadcasted *during*
the subscription request and client receive messages in wrong order.'''
- self.connection_ref().on_finish.addCallback(self._finish_after_subscribe)
\ No newline at end of file
+ self.connection_ref().on_finish.addCallback(self._finish_after_subscribe)
+