git://git.novaco.in
/
p2pool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
optimized share weight adding, fixed runaway bitcoind request bug, made peer requests...
[p2pool.git]
/
p2pool
/
util
/
math.py
diff --git
a/p2pool/util/math.py
b/p2pool/util/math.py
index
d291d1e
..
07a631a
100644
(file)
--- a/
p2pool/util/math.py
+++ b/
p2pool/util/math.py
@@
-47,3
+47,10
@@
def geometric(p):
if p == 1:
return 1
return int(math.log1p(-random.random()) / math.log1p(-p)) + 1
+
+def add_dicts(dicts):
+ res = {}
+ for d in dicts:
+ for k, v in d.iteritems():
+ res[k] = res.get(k, 0) + v
+ return dict((k, v) for k, v in res.iteritems() if v)