Browse Source

Fix off-by-one error in length of telescoping circuits

It was creating circuits of guard plus 3 hops, not 3 hops including the
guard, because the guard itself wasn't in the circuit_descs list.
Ian Goldberg 4 years ago
parent
commit
ab41808843
1 changed files with 3 additions and 1 deletions
  1. 3 1
      client.py

+ 3 - 1
client.py

@@ -84,6 +84,8 @@ class TelescopingCreatedHandler:
 
         circhandler.replace_celltype_handler(relay.TelescopingCreatedCircuitCell, None)
 
+        circhandler.circuit_descs.append(self.channelmgr.guard)
+
         nexthopidx = None
         while nexthopidx is None:
             nexthopidx = self.channelmgr.relaypicker.pick_weighted_relay_index()
@@ -135,7 +137,7 @@ class TelescopingExtendedHandler:
         # Are we done building the circuit?
         logging.warning("we may need another circhandler structure for snips")
         if len(circhandler.circuit_descs) == 3:
-            logging.debug("Circuit is long enough; exiting.")
+            logging.debug("Circuit [%s] is long enough; exiting.", [str(x.snipdict['addr']) for x in circhandler.circuit_descs])
             # Yes!
             return