The unified diff between revisions [850c20aa..] and [a80e1661..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'netsync.cc'

#
#
# patch "netsync.cc"
#  from [b3cddb10629e909ba4bbb0a4a254cf80419a942e]
#    to [b253cccce899ebf482d4b14f0ce08139079018c2]
#
============================================================
--- netsync.cc	b3cddb10629e909ba4bbb0a4a254cf80419a942e
+++ netsync.cc	b253cccce899ebf482d4b14f0ce08139079018c2
@@ -3486,27 +3486,25 @@ session::rebuild_merkle_trees(app_state
   set<revision_id> revision_ids;
   set<rsa_keypair_id> inserted_keys;

-  // bad_branch_certs is a set of cert hashes.
-  set< hexenc<id> > bad_branch_certs;
   {
-    // get all matching branch names
-    vector< revision<cert> > certs;
-    app.db.get_revision_certs(branch_cert_name, certs);
-    for (size_t i = 0; i < certs.size(); ++i)
+    // Get our branches
+    vector<string> names;
+    get_branches(app, names);
+    for (size_t i = 0; i < names.size(); ++i)
       {
-        cert_value name;
-        decode_base64(idx(certs, i).inner().value, name);
-        if (branchnames.find(name()) != branchnames.end())
+        if(branchnames.find(names[i]) != branchnames.end())
           {
-            insert_with_parents(revision_id(idx(certs, i).inner().ident),
-                                revision_ids, app, revisions_ticker);
+            // branch matches, get its certs
+            vector< revision<cert> > certs;
+            base64<cert_value> encoded_name;
+            encode_base64(cert_value(names[i]),encoded_name);
+            app.db.get_revision_certs(branch_cert_name, encoded_name, certs);
+            for (size_t j = 0; j < certs.size(); ++j)
+              {
+                insert_with_parents(revision_id(idx(certs,j).inner().ident),
+                                    revision_ids, app, revisions_ticker);
+              }
           }
-        else
-          {
-            hexenc<id> hash;
-            cert_hash_code(idx(certs, i).inner(), hash);
-            bad_branch_certs.insert(hash);
-          }
       }
   }

@@ -3543,6 +3541,7 @@ session::rebuild_merkle_trees(app_state
     std::pair<revision_id, rsa_keypair_id> > > cert_idx;

   cert_idx idx;
+  // <mrb> this also gets *all* certs, needed?
   app.db.get_revision_cert_index(idx);

   // insert all certs and keys reachable via these revisions,
@@ -3556,8 +3555,6 @@ session::rebuild_merkle_trees(app_state

       if (revision_ids.find(ident) == revision_ids.end())
         continue;
-      if (bad_branch_certs.find(hash) != bad_branch_certs.end())
-        continue;

       id raw_hash;
       decode_hexenc(hash, raw_hash);