From 2dffea00ee99f2c624a8504afee37532ba3daa5d Mon Sep 17 00:00:00 2001 From: Forrest Voight Date: Mon, 31 Dec 2012 17:56:38 -0500 Subject: [PATCH] send work right after subscribe with unknown username to work with stratum-mining-proxy --- p2pool/bitcoin/stratum.py | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/p2pool/bitcoin/stratum.py b/p2pool/bitcoin/stratum.py index 464af52..b70ac3e 100644 --- a/p2pool/bitcoin/stratum.py +++ b/p2pool/bitcoin/stratum.py @@ -18,6 +18,8 @@ class StratumRPCMiningProvider(object): self.watch_id = self.wb.new_work_event.watch(self._send_work) def rpc_subscribe(self): + reactor.callLater(0, self._send_work) + return [ ["mining.notify", "ae6812eb4cd7735a302a8a9dd95cf71f"], # subscription details "", # extranonce1 @@ -30,10 +32,7 @@ class StratumRPCMiningProvider(object): reactor.callLater(0, self._send_work) def _send_work(self): - if self.username is None: # authorize hasn't been received yet - return - - x, got_response = self.wb.get_work(*self.wb.preprocess_request(self.username)) + x, got_response = self.wb.get_work(*self.wb.preprocess_request('' if self.username is None else self.username)) jobid = str(random.randrange(2**128)) self.other.svc_mining.rpc_set_difficulty(bitcoin_data.target_to_difficulty(x['share_target'])).addErrback(lambda err: None) self.other.svc_mining.rpc_notify( -- 1.7.1