mirror of
https://github.com/vacp2p/mix.git
synced 2026-01-09 21:07:59 -05:00
Update src/mix_protocol.nim
- Simplify with valueOr Co-authored-by: richΛrd <info@richardramos.me>
This commit is contained in:
@@ -195,12 +195,9 @@ proc anonymizeLocalProtocolSend*(
|
||||
if i == L - 1:
|
||||
randPeerId = destPeerId
|
||||
else:
|
||||
let cryptoRandomIntResult = cryptoRandomInt(availableIndices.len)
|
||||
if cryptoRandomIntResult.isErr:
|
||||
let randomIndexPosition = cryptoRandomInt(availableIndices.len).valueOr:
|
||||
error "Failed to generate random number", err = cryptoRandomIntResult.error
|
||||
return
|
||||
let
|
||||
randomIndexPosition = cryptoRandomIntResult.value
|
||||
selectedIndex = availableIndices[randomIndexPosition]
|
||||
randPeerId = pubNodeInfoKeys[selectedIndex]
|
||||
availableIndices.del(randomIndexPosition)
|
||||
|
||||
Reference in New Issue
Block a user