From c70a9b2d8238e5b02a05dcb8a28fb5f848926911 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Mon, 1 Mar 2021 23:17:48 +0200 Subject: [PATCH] Remove stale DEFAULT_NODES --- src/network/knownnodes.py | 31 +------------------------------ src/tests/core.py | 8 -------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/src/network/knownnodes.py b/src/network/knownnodes.py index 4840aad9..cce80ae7 100644 --- a/src/network/knownnodes.py +++ b/src/network/knownnodes.py @@ -36,18 +36,6 @@ knownNodesActual = False logger = logging.getLogger('default') -DEFAULT_NODES = ( - Peer('5.45.99.75', 8444), - Peer('75.167.159.54', 8444), - Peer('95.165.168.168', 8444), - Peer('85.180.139.241', 8444), - Peer('158.222.217.190', 8080), - Peer('178.62.12.187', 8448), - Peer('24.188.198.204', 8111), - Peer('109.147.204.113', 1195), - Peer('178.11.46.221', 8444) -) - def json_serialize_knownnodes(output): """ @@ -73,8 +61,7 @@ def json_deserialize_knownnodes(source): info = node['info'] peer = Peer(str(peer['host']), peer.get('port', 8444)) knownNodes[node['stream']][peer] = info - if not (knownNodesActual - or info.get('self')) and peer not in DEFAULT_NODES: + if not (knownNodesActual or info.get('self')): knownNodesActual = True @@ -142,14 +129,6 @@ def addKnownNode(stream, peer, lastseen=None, is_self=False): return True -def createDefaultKnownNodes(): - """Creating default Knownnodes""" - past = time.time() - 2418600 # 28 days - 10 min - for peer in DEFAULT_NODES: - addKnownNode(1, peer, past) - saveKnownNodes() - - def readKnownNodes(): """Load knownnodes from filesystem""" try: @@ -163,7 +142,6 @@ def readKnownNodes(): except (IOError, OSError, KeyError, EOFError): logger.debug( 'Failed to read nodes from knownnodes.dat', exc_info=True) - createDefaultKnownNodes() config = BMConfigParser() @@ -221,13 +199,6 @@ def trimKnownNodes(recAddrStream=1): del knownNodes[recAddrStream][oldest] -def dns(): - """Add DNS names to knownnodes""" - for port in [8080, 8444]: - addKnownNode( - 1, Peer('bootstrap%s.bitmessage.org' % port, port)) - - def cleanupKnownNodes(): """ Cleanup knownnodes: remove old nodes and nodes with low rating diff --git a/src/tests/core.py b/src/tests/core.py index 2971f2f7..12a81852 100644 --- a/src/tests/core.py +++ b/src/tests/core.py @@ -154,14 +154,6 @@ class TestCore(unittest.TestCase): self_count += 1 self.assertEqual(n - self_count, 2) - def test_knownnodes_default(self): - """test adding default knownnodes if nothing loaded""" - cleanup(files=('knownnodes.dat',)) - self._wipe_knownnodes() - knownnodes.readKnownNodes() - self.assertGreaterEqual( - len(knownnodes.knownNodes[1]), len(knownnodes.DEFAULT_NODES)) - def test_0_cleaner(self): """test knownnodes starvation leading to IndexError in Asyncore""" self._outdate_knownnodes()