Small gossip fixes
This commit is contained in:
parent
ac88e0a1da
commit
6b6d357a13
@ -8,7 +8,6 @@ app_root = os.path.dirname(os.path.realpath(__file__)) + '/../../'
|
||||
gossip_server_socket_file = home + 'gossip-server.sock'
|
||||
|
||||
usage_file = home + 'disk-usage.txt'
|
||||
block_data_location = home + 'blocks/'
|
||||
contacts_location = home + 'contacts/'
|
||||
public_API_host_file = home + 'public-host.txt'
|
||||
private_API_host_file = home + 'private-host.txt'
|
||||
|
@ -33,7 +33,7 @@ def store_blocks(dandelion_phase: 'DandelionPhase'):
|
||||
and dandelion_phase.remaining_time() > 1:
|
||||
try:
|
||||
blockdb.add_block_to_db(
|
||||
new_queue.get(timeout=dandelion_phase.remaining_time())
|
||||
new_queue.get(timeout=dandelion_phase.remaining_time() + 1)
|
||||
)
|
||||
except Empty:
|
||||
pass
|
||||
|
@ -31,7 +31,7 @@ def create_dirs():
|
||||
"""Create onionr data-related directories in
|
||||
order of the hardcoded list below,
|
||||
then trigger creation of DBs"""
|
||||
gen_dirs = [home, filepaths.block_data_location,
|
||||
gen_dirs = [home,
|
||||
filepaths.contacts_location,
|
||||
filepaths.export_location]
|
||||
for path in gen_dirs:
|
||||
|
@ -8,18 +8,19 @@ from torpeer import TorPeer
|
||||
def on_announce_rec(api, data=None):
|
||||
socks_address, socks_port = get_socks()[0]
|
||||
|
||||
announced = data['address']
|
||||
announced: str = data['address']
|
||||
try:
|
||||
announced = announced.decode('utf-8')
|
||||
except AttributeError:
|
||||
pass
|
||||
announced = announced.strip()
|
||||
|
||||
if announced == config.get('tor.transport_address'):
|
||||
if announced.removesuffix('.onion') == config.get(
|
||||
'tor.transport_address', '').removesuffix('.onion'):
|
||||
logger.warn(
|
||||
"Received announcement for our own node, which shouldn't happen")
|
||||
return
|
||||
|
||||
announced = announced.strip()
|
||||
if not announced.endswith('.onion'):
|
||||
announced += '.onion'
|
||||
|
||||
|
@ -71,7 +71,7 @@ class OnionrGossipClientGetNewPeers(unittest.TestCase):
|
||||
|
||||
def test_get_new_peers_no_peers(self):
|
||||
gossip_peer_set.clear()
|
||||
self.assertRaises(ValueError, get_new_peers)
|
||||
get_new_peers()
|
||||
self.assertFalse(len(gossip_peer_set))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user