Added logic for less strict dandelion++ fanout in order to enable smaller networks to function more quickly
This commit is contained in:
parent
84c13ade51
commit
e7daaf576f
@ -7,6 +7,7 @@ from typing import TYPE_CHECKING, Coroutine, List
|
|||||||
|
|
||||||
from ordered_set import OrderedSet
|
from ordered_set import OrderedSet
|
||||||
|
|
||||||
|
import config
|
||||||
from onionrthreads import add_delayed_thread
|
from onionrthreads import add_delayed_thread
|
||||||
from blockdb import add_block_to_db
|
from blockdb import add_block_to_db
|
||||||
import logger
|
import logger
|
||||||
@ -81,6 +82,7 @@ async def stem_out(d_phase: 'DandelionPhase'):
|
|||||||
sleep(1)
|
sleep(1)
|
||||||
return
|
return
|
||||||
not_enough_edges = False
|
not_enough_edges = False
|
||||||
|
strict_dandelion = config.get('security.strict_dandelion', True)
|
||||||
|
|
||||||
def blackhole_protection(q):
|
def blackhole_protection(q):
|
||||||
for bl in q:
|
for bl in q:
|
||||||
@ -114,7 +116,14 @@ async def stem_out(d_phase: 'DandelionPhase'):
|
|||||||
# "Making too few edges for stemout " +
|
# "Making too few edges for stemout " +
|
||||||
# "this is bad for anonymity if frequent.",
|
# "this is bad for anonymity if frequent.",
|
||||||
# terminal=True)
|
# terminal=True)
|
||||||
not_enough_edges = True
|
if strict_dandelion:
|
||||||
|
not_enough_edges = True
|
||||||
|
else:
|
||||||
|
if peer_sockets:
|
||||||
|
# if we have at least 1 peer,
|
||||||
|
# do dandelion anyway in non strict mode
|
||||||
|
# Allow poorly connected networks to communicate faster
|
||||||
|
break
|
||||||
sleep(1)
|
sleep(1)
|
||||||
else:
|
else:
|
||||||
# Ran out of time for stem phase
|
# Ran out of time for stem phase
|
||||||
|
Loading…
Reference in New Issue
Block a user