Remove stale DEFAULT_NODES
This commit is contained in:
parent
e845aa8b00
commit
c70a9b2d82
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Reference in New Issue
Block a user