summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-02-06 17:41:54 +0100
committerMagnus Ahltorp <map@kth.se>2015-02-06 17:41:54 +0100
commit4c0f8c196ad6c0d5b9c62949044a12def31eb967 (patch)
tree3bd28c1b6dd75f052674fe5bf61c23adb6855088
parent2bcec60fe58599fa5d1518163e0c1b30ecd85ad7 (diff)
Don't ask all nodes for entries.
-rwxr-xr-xtools/merge.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/merge.py b/tools/merge.py
index 9e60ca2..004b98b 100755
--- a/tools/merge.py
+++ b/tools/merge.py
@@ -57,7 +57,7 @@ def get_new_entries(baseurl):
result = urllib2.urlopen(baseurl + "ct/storage/fetchnewentries").read()
parsed_result = json.loads(result)
if parsed_result.get(u"result") == u"ok":
- return parsed_result[u"entries"]
+ return [base64.b64decode(entry) for entry in parsed_result[u"entries"]]
print "ERROR: fetchnewentries", parsed_result
sys.exit(1)
except urllib2.HTTPError, e:
@@ -164,24 +164,27 @@ new_entries_per_node = {}
new_entries = set()
for storagenode in storagenodes:
+ print "getting new entries from", storagenode
new_entries_per_node[storagenode] = get_new_entries(storagenode)
new_entries.update(set(new_entries_per_node[storagenode]))
timing_point(timing, "get new entries")
+new_entries -= certsinlog
+
print "adding", len(new_entries), "entries"
if args.nomerge:
sys.exit(0)
added_entries = 0
-for new_entry in new_entries:
- hash = base64.b64decode(new_entry)
+for hash in new_entries:
if hash not in certsinlog:
entry = None
for storagenode in storagenodes:
- if new_entry in new_entries_per_node[storagenode]:
+ if hash in new_entries_per_node[storagenode]:
entry = get_entry(storagenode, hash)
+ break
assert entry != None
write_chain(hash, entry)
add_to_logorder(hash)