|
20 | 20 | members: HashSet[I] |
21 | 21 |
|
22 | 22 | ConnCreds = object |
23 | | - group: IGroup |
| 23 | + igroup: IGroup |
24 | 24 | incoming: AsyncQueue[seq[byte]] |
25 | 25 | surbSecret: secret |
26 | 26 | surbKey: key |
@@ -238,17 +238,17 @@ proc handleMixNodeConnection( |
238 | 238 |
|
239 | 239 | let connCred = mixProto.connCreds[processedSP.id] |
240 | 240 |
|
241 | | - # Deleting all other SURBs associated to this |
242 | | - for id in connCred.group.members: |
243 | | - mixProto.connCreds.del(id) |
244 | | - |
245 | 241 | let reply = processReply( |
246 | 242 | connCred.surbKey, connCred.surbSecret, processedSP.delta_prime |
247 | 243 | ).valueOr: |
248 | 244 | error "could not process reply", id = processedSP.id |
249 | 245 | mix_messages_error.inc(labelValues = ["Reply", "INVALID_CREDS"]) |
250 | 246 | return |
251 | 247 |
|
| 248 | + # Deleting all other SURBs associated to this |
| 249 | + for id in connCred.igroup.members: |
| 250 | + mixProto.connCreds.del(id) |
| 251 | + |
252 | 252 | let msgChunk = MessageChunk.deserialize(reply).valueOr: |
253 | 253 | error "Deserialization failed", err = error |
254 | 254 | mix_messages_error.inc(labelValues = ["Reply", "INVALID_SPHINX"]) |
@@ -366,8 +366,8 @@ proc buildSurbs( |
366 | 366 | exitPeerId: PeerId, |
367 | 367 | ): Result[seq[SURB], string] = |
368 | 368 | var response: seq[SURB] |
369 | | - var group = IGroup(members: initHashSet[I]()) |
370 | | - |
| 369 | + var igroup = IGroup(members: initHashSet[I]()) |
| 370 | + |
371 | 371 | for _ in uint8(0) ..< numSurbs: |
372 | 372 | var |
373 | 373 | id: I |
@@ -432,8 +432,13 @@ proc buildSurbs( |
432 | 432 | let surb = createSURB(publicKeys, delay, hops, id).valueOr: |
433 | 433 | return err(error) |
434 | 434 |
|
435 | | - group.members.incl(id) |
436 | | - mixProto.connCreds[id] = ConnCreds(group: group, surbSecret: surb.secret.get(), surbKey: surb.key, incoming: incoming) |
| 435 | + igroup.members.incl(id) |
| 436 | + mixProto.connCreds[id] = ConnCreds( |
| 437 | + igroup: igroup, |
| 438 | + surbSecret: surb.secret.get(), |
| 439 | + surbKey: surb.key, |
| 440 | + incoming: incoming, |
| 441 | + ) |
437 | 442 | response.add(surb) |
438 | 443 |
|
439 | 444 | return ok(response) |
|
0 commit comments