From 4c0f8c196ad6c0d5b9c62949044a12def31eb967 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Fri, 6 Feb 2015 17:41:54 +0100 Subject: Don't ask all nodes for entries. --- tools/merge.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tools/merge.py') 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) -- cgit v1.1