diff options
author | joe <joe@jerkface.net> | 2017-10-13 14:00:33 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-10-13 14:00:33 -0400 |
commit | d0666b1beffa2684552ff6e0c1c077f530784ee2 (patch) | |
tree | 07cab736f9f16cfe8e443d5fab5e537b768e947f /src/Network/Tox | |
parent | 8d7f1fee8b06f7c38fad950d53abd382102ca4c6 (diff) |
Removed unused routeNonce (same nonce for message is used for route).
Diffstat (limited to 'src/Network/Tox')
-rw-r--r-- | src/Network/Tox/Onion/Transport.hs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Network/Tox/Onion/Transport.hs b/src/Network/Tox/Onion/Transport.hs index eabd9473..989b06fd 100644 --- a/src/Network/Tox/Onion/Transport.hs +++ b/src/Network/Tox/Onion/Transport.hs | |||
@@ -192,8 +192,7 @@ encodeOnionAddr _ (msg,OnionDestination _ Nothing ) = do | |||
192 | hPutStrLn stderr $ "ONION encode missing routeid" | 192 | hPutStrLn stderr $ "ONION encode missing routeid" |
193 | return Nothing | 193 | return Nothing |
194 | encodeOnionAddr getRoute (msg,OnionDestination ni (Just rid)) = do | 194 | encodeOnionAddr getRoute (msg,OnionDestination ni (Just rid)) = do |
195 | let go route0 = do | 195 | let go route = do |
196 | let route = route0 { routeNonce = msgNonce msg } -- TODO: This necessary? | ||
197 | return ( runPut $ putRequest $ wrapForRoute msg ni route | 196 | return ( runPut $ putRequest $ wrapForRoute msg ni route |
198 | , nodeAddr $ routeNodeA route) | 197 | , nodeAddr $ routeNodeA route) |
199 | mapM' f x = do | 198 | mapM' f x = do |
@@ -635,8 +634,7 @@ transcode f (OnionToRouteResponse a) = OnionToRouteResponse a | |||
635 | 634 | ||
636 | 635 | ||
637 | data OnionRoute = OnionRoute | 636 | data OnionRoute = OnionRoute |
638 | { routeNonce :: Nonce24 | 637 | { routeAliasA :: SecretKey |
639 | , routeAliasA :: SecretKey | ||
640 | , routeAliasB :: SecretKey | 638 | , routeAliasB :: SecretKey |
641 | , routeAliasC :: SecretKey | 639 | , routeAliasC :: SecretKey |
642 | , routeNodeA :: NodeInfo | 640 | , routeNodeA :: NodeInfo |
@@ -645,18 +643,21 @@ data OnionRoute = OnionRoute | |||
645 | } | 643 | } |
646 | 644 | ||
647 | wrapForRoute :: OnionMessage Encrypted -> NodeInfo -> OnionRoute -> OnionRequest N0 | 645 | wrapForRoute :: OnionMessage Encrypted -> NodeInfo -> OnionRoute -> OnionRequest N0 |
648 | wrapForRoute msg ni r = OnionRequest | 646 | wrapForRoute msg ni r = |
649 | { onionNonce = routeNonce r | 647 | -- We needn't use the same nonce value here, but I think it is safe to do so. |
648 | let nonce = msgNonce msg | ||
649 | in OnionRequest | ||
650 | { onionNonce = nonce | ||
650 | , onionForward = wrapOnion (routeAliasA r) | 651 | , onionForward = wrapOnion (routeAliasA r) |
651 | (routeNonce r) | 652 | nonce |
652 | (id2key . nodeId $ routeNodeA r) | 653 | (id2key . nodeId $ routeNodeA r) |
653 | (nodeAddr $ routeNodeB r) | 654 | (nodeAddr $ routeNodeB r) |
654 | $ wrapOnion (routeAliasB r) | 655 | $ wrapOnion (routeAliasB r) |
655 | (routeNonce r) | 656 | nonce |
656 | (id2key . nodeId $ routeNodeB r) | 657 | (id2key . nodeId $ routeNodeB r) |
657 | (nodeAddr $ routeNodeC r) | 658 | (nodeAddr $ routeNodeC r) |
658 | $ wrapOnion (routeAliasC r) | 659 | $ wrapOnion (routeAliasC r) |
659 | (routeNonce r) | 660 | nonce |
660 | (id2key . nodeId $ routeNodeC r) | 661 | (id2key . nodeId $ routeNodeC r) |
661 | (nodeAddr ni) | 662 | (nodeAddr ni) |
662 | $ NotForwarded msg | 663 | $ NotForwarded msg |