This commit is contained in:
Youngjoon Lee 2024-06-28 17:34:13 +09:00
parent d3476d3ebb
commit 235c7031c9
No known key found for this signature in database
GPG Key ID: B4253AFBA618BF4D

View File

@ -15,10 +15,10 @@ from pysphinx.sphinx import (
from mixnet.config import GlobalConfig, NodeConfig
from mixnet.packet import Fragment, MessageFlag, MessageReconstructor, PacketBuilder
NetworkPacket: TypeAlias = "SphinxPacket | bytes"
NetworkPacketQueue: TypeAlias = "asyncio.Queue[NetworkPacket]"
NetworkPacket: TypeAlias = SphinxPacket | bytes
NetworkPacketQueue: TypeAlias = asyncio.Queue[NetworkPacket]
Connection: TypeAlias = NetworkPacketQueue
BroadcastChannel: TypeAlias = "asyncio.Queue[bytes]"
BroadcastChannel: TypeAlias = asyncio.Queue[bytes]
class Node:
@ -47,8 +47,8 @@ class Node:
return processed.next_packet
case ProcessedFinalHopPacket():
await self.__process_sphinx_payload(processed.payload)
except Exception:
# Return SphinxPacket as it is, if this node cannot unwrap it.
except ValueError:
# Return SphinxPacket as it is, if it cannot be unwrapped by the private key of this node.
return packet
async def __process_sphinx_payload(self, payload: Payload):