diff options
Diffstat (limited to 'tools/merge.py')
-rwxr-xr-x | tools/merge.py | 11 |
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) |