mirror of
https://github.com/logos-co/nomos-specs.git
synced 2025-01-20 20:40:15 +00:00
do not declare class variables
This commit is contained in:
parent
ad669abc6b
commit
e1abc44592
@ -12,9 +12,6 @@ class DuplexConnection:
|
||||
This is to mimic duplex communication in a real network (such as TCP or QUIC).
|
||||
"""
|
||||
|
||||
inbound: SimplexConnection
|
||||
outbound: MixSimplexConnection
|
||||
|
||||
def __init__(self, inbound: SimplexConnection, outbound: MixSimplexConnection):
|
||||
self.inbound = inbound
|
||||
self.outbound = outbound
|
||||
@ -31,11 +28,6 @@ class MixSimplexConnection:
|
||||
Wraps a SimplexConnection to add a transmission rate and noise to the connection.
|
||||
"""
|
||||
|
||||
queue: NetworkPacketQueue
|
||||
conn: SimplexConnection
|
||||
transmission_rate_per_sec: int
|
||||
noise_msg: bytes
|
||||
|
||||
def __init__(
|
||||
self, conn: SimplexConnection, transmission_rate_per_sec: int, noise_msg: bytes
|
||||
):
|
||||
|
@ -24,11 +24,6 @@ class Node:
|
||||
- generates noise
|
||||
"""
|
||||
|
||||
config: NodeConfig
|
||||
global_config: GlobalConfig
|
||||
nomssip: Nomssip
|
||||
broadcast_channel: BroadcastChannel
|
||||
|
||||
def __init__(self, config: NodeConfig, global_config: GlobalConfig):
|
||||
self.config = config
|
||||
self.global_config = global_config
|
||||
|
@ -19,25 +19,19 @@ class Nomssip:
|
||||
peering_degree: int
|
||||
msg_size: int
|
||||
|
||||
config: Config
|
||||
conns: list[DuplexConnection]
|
||||
# A handler to process inbound messages.
|
||||
handler: Callable[[bytes], Awaitable[None]]
|
||||
# A set of packet hashes to prevent gossiping/processing the same packet twice.
|
||||
packet_cache: set[bytes]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: Config,
|
||||
handler: Callable[[bytes], Awaitable[None]],
|
||||
):
|
||||
self.config = config
|
||||
self.conns = []
|
||||
self.conns: list[DuplexConnection] = []
|
||||
# A handler to process inbound messages.
|
||||
self.handler = handler
|
||||
self.packet_cache = set()
|
||||
self.packet_cache: set[bytes] = set()
|
||||
# A set just for gathering a reference of tasks to prevent them from being garbage collected.
|
||||
# https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task
|
||||
self.tasks = set()
|
||||
self.tasks: set[asyncio.Task] = set()
|
||||
|
||||
def add_conn(self, inbound: SimplexConnection, outbound: SimplexConnection):
|
||||
if len(self.conns) >= self.config.peering_degree:
|
||||
|
Loading…
x
Reference in New Issue
Block a user