From 41c4fdc3cee33965f9ae00c0eb0eb8b81d3ff107 Mon Sep 17 00:00:00 2001 From: Forrest Voight Date: Sun, 7 Jul 2013 03:58:36 -0400 Subject: [PATCH] fixed incompatibility bug with pypy --- p2pool/util/math.py | 5 +++++ p2pool/work.py | 2 +- 2 files changed, 6 insertions(+), 1 deletions(-) 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, -- 1.7.1