git://git.novaco.in
/
p2pool.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
dd47b1c
)
made util.pack.ComposedType check that the keys in a packet item exactly match the...
author
Forrest Voight
<forrest@forre.st>
Mon, 13 Feb 2012 20:40:33 +0000 (15:40 -0500)
committer
Forrest Voight
<forrest@forre.st>
Mon, 13 Feb 2012 20:40:33 +0000 (15:40 -0500)
p2pool/util/pack.py
patch
|
blob
|
history
diff --git
a/p2pool/util/pack.py
b/p2pool/util/pack.py
index
11a427c
..
10fe3f6
100644
(file)
--- a/
p2pool/util/pack.py
+++ b/
p2pool/util/pack.py
@@
-254,6
+254,7
@@
def get_record(fields):
class ComposedType(Type):
def __init__(self, fields):
self.fields = tuple(fields)
+ self.field_names = set(k for k, v in fields)
def read(self, file):
item = get_record(k for k, v in self.fields)
@@
-262,6
+263,7
@@
class ComposedType(Type):
return item, file
def write(self, file, item):
+ assert set(item.keys()) == self.field_names
for key, type_ in self.fields:
file = type_.write(file, item[key])
return file