mirror of
https://github.com/logos-blockchain/logos-blockchain-specs.git
synced 2026-01-09 16:43:10 +00:00
add an option to turn off mixing
This commit is contained in:
parent
84ec0b06ff
commit
a46dbfe826
@ -62,7 +62,7 @@ class MixnetConfig:
|
||||
|
||||
def validate(self):
|
||||
assert self.num_nodes > 0
|
||||
assert 0 < self.num_mix_layers <= self.num_nodes
|
||||
assert 0 <= self.num_mix_layers <= self.num_nodes
|
||||
assert self.payload_size > 0
|
||||
assert self.message_interval > 0
|
||||
assert self.real_message_prob > 0
|
||||
|
||||
@ -4,6 +4,8 @@ simulation:
|
||||
|
||||
mixnet:
|
||||
num_nodes: 100
|
||||
# A number of mix nodes selected by a message sender through which the Sphinx message goes through
|
||||
# If 0, the message is broadcast directly to all nodes without being Sphinx-encoded.
|
||||
num_mix_layers: 3
|
||||
# A size of a message payload in bytes (e.g. the size of a block proposal)
|
||||
payload_size: 320
|
||||
|
||||
@ -63,6 +63,9 @@ class Node:
|
||||
Creates a real or cover message
|
||||
@return:
|
||||
"""
|
||||
if self.config.mixnet.num_mix_layers == 0: # if mixing is turned off
|
||||
return self.build_payload()
|
||||
|
||||
mixes = self.p2p.get_nodes(self.config.mixnet.num_mix_layers)
|
||||
public_keys = [mix.public_key for mix in mixes]
|
||||
# TODO: replace with realistic tx
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user