From: Forrest Voight Date: Sun, 7 Jul 2013 07:58:36 +0000 (-0400) Subject: fixed incompatibility bug with pypy X-Git-Tag: 13.0~1 X-Git-Url: https://git.novaco.in/?p=p2pool.git;a=commitdiff_plain;h=41c4fdc3cee33965f9ae00c0eb0eb8b81d3ff107;hp=4cde79363018833bd47e411d12dff8263a17c8e6 fixed incompatibility bug with pypy --- diff --git a/p2pool/util/math.py b/p2pool/util/math.py index 04ed3ff..6ceb9ff 100644 --- a/p2pool/util/math.py +++ b/p2pool/util/math.py @@ -230,3 +230,8 @@ class RateMonitor(object): self.first_timestamp = t else: self.datums.append((t, datum)) + +def merge_dicts(*dicts): + res = {} + for d in dicts: res.update(d) + return res diff --git a/p2pool/work.py b/p2pool/work.py index df9f787..5534b01 100644 --- a/p2pool/work.py +++ b/p2pool/work.py @@ -68,7 +68,7 @@ class WorkerBridge(worker_interface.WorkerBridge): merged_proxy = jsonrpc.HTTPProxy(merged_url, dict(Authorization='Basic ' + base64.b64encode(merged_userpass))) while self.running: auxblock = yield deferral.retry('Error while calling merged getauxblock:', 30)(merged_proxy.rpc_getauxblock)() - self.merged_work.set(dict(self.merged_work.value, **{auxblock['chainid']: dict( + self.merged_work.set(math.merge_dicts(self.merged_work.value, {auxblock['chainid']: dict( hash=int(auxblock['hash'], 16), target='p2pool' if auxblock['target'] == 'p2pool' else pack.IntType(256).unpack(auxblock['target'].decode('hex')), merged_proxy=merged_proxy,