mirror of
https://github.com/logos-blockchain/logos-blockchain-specs.git
synced 2026-01-29 02:13:08 +00:00
add max_network_latency
This commit is contained in:
parent
fb4fb48712
commit
93acaa436e
@ -22,6 +22,8 @@ class Config:
|
||||
cover_message_prob: float
|
||||
# A maximum preparation time (delay) before sending the message
|
||||
max_message_prep_time: float
|
||||
# A maximum network latency between nodes directly connected with each other
|
||||
max_network_latency: float
|
||||
|
||||
@classmethod
|
||||
def load(cls, yaml_path: str) -> Self:
|
||||
@ -40,5 +42,6 @@ class Config:
|
||||
assert weight >= 1
|
||||
assert config.cover_message_prob >= 0
|
||||
assert config.max_message_prep_time >= 0
|
||||
assert config.max_network_latency >= 0
|
||||
|
||||
return config
|
||||
|
||||
@ -13,4 +13,6 @@ real_message_prob_weights: [10, 8, 12]
|
||||
# A probability of sending a cover message within a cycle if not sending a real message
|
||||
cover_message_prob: 0.2
|
||||
# A maximum preparation time (delay) before sending the message
|
||||
max_message_prep_time: 0.3
|
||||
max_message_prep_time: 0.3
|
||||
# A maximum network latency between nodes directly connected with each other
|
||||
max_network_latency: 0.5
|
||||
@ -74,7 +74,7 @@ class Node:
|
||||
@param msg: the message to be processed
|
||||
"""
|
||||
# simulating network latency
|
||||
yield self.env.timeout(random.randint(0, 3))
|
||||
yield self.env.timeout(random.uniform(0, self.config.max_network_latency))
|
||||
|
||||
if isinstance(msg, SphinxPacket):
|
||||
msg, incentive_tx = msg.unwrap(self.private_key)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user