...
Sorry, not in a patch form.
OK, fixed that. Here is a diff of it.
diff --git pyminer.py pyminer.py
index 051abb3..b203aa8 100755
--- pyminer.py
+++ pyminer.py
@@ -97,8 +97,9 @@ def wordreverse(in_buf):
return ''.join(out_words)
class Miner:
- def __init__(self, id):
+ def __init__(self, id, settings=None):
self.id = id
+ self.settings=settings
self.max_nonce = MAX_NONCE
def work(self, datastr, targetstr):
@@ -181,11 +182,11 @@ class Miner:
time_diff = time_end - time_start
self.max_nonce = long(
- (hashes_done * settings['scantime']) / time_diff)
+ (hashes_done * self.settings['scantime']) / time_diff)
if self.max_nonce > 0xfffffffaL:
self.max_nonce = 0xfffffffaL
- if settings['hashmeter']:
+ if self.settings['hashmeter']:
print "HashMeter(%d): %d hashes, %.2f Khash/sec" % (
self.id, hashes_done,
(hashes_done / 1000.0) / time_diff)
@@ -194,16 +195,16 @@ class Miner:
self.submit_work(rpc, work['data'], nonce_bin)
def loop(self):
- rpc = BitcoinRPC(settings['host'], settings['port'],
- settings['rpcuser'], settings['rpcpass'])
+ rpc = BitcoinRPC(self.settings['host'], self.settings['port'],
+ self.settings['rpcuser'], self.settings['rpcpass'])
if rpc is None:
return
while True:
self.iterate(rpc)
-def miner_thread(id):
- miner = Miner(id)
+def miner_thread(id, settings):
+ miner = Miner(id, settings)
miner.loop()
if __name__ == '__main__':
@@ -248,7 +249,7 @@ if __name__ == '__main__':
thr_list = []
for thr_id in range(settings['threads']):
- p = Process(target=miner_thread, args=(thr_id,))
+ p = Process(target=miner_thread, args=(thr_id, settings,))
p.start()
thr_list.append(p)
time.sleep(1) # stagger threads