Create default knownnodes if cannot read from file
This commit is contained in:
parent
b499e1bd22
commit
659d45bb15
|
@ -17,6 +17,18 @@ knownNodesTrimAmount = 2000
|
||||||
# forget a node after rating is this low
|
# forget a node after rating is this low
|
||||||
knownNodesForgetRating = -0.5
|
knownNodesForgetRating = -0.5
|
||||||
|
|
||||||
|
DEFAULT_NODES = (
|
||||||
|
state.Peer('5.45.99.75', 8444),
|
||||||
|
state.Peer('75.167.159.54', 8444),
|
||||||
|
state.Peer('95.165.168.168', 8444),
|
||||||
|
state.Peer('85.180.139.241', 8444),
|
||||||
|
state.Peer('158.222.217.190', 8080),
|
||||||
|
state.Peer('178.62.12.187', 8448),
|
||||||
|
state.Peer('24.188.198.204', 8111),
|
||||||
|
state.Peer('109.147.204.113', 1195),
|
||||||
|
state.Peer('178.11.46.221', 8444)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def json_serialize_knownnodes(output):
|
def json_serialize_knownnodes(output):
|
||||||
"""
|
"""
|
||||||
|
@ -70,6 +82,12 @@ def addKnownNode(stream, peer, lastseen=None, is_self=False):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def createDefaultKnownNodes():
|
||||||
|
for peer in DEFAULT_NODES:
|
||||||
|
addKnownNode(1, peer)
|
||||||
|
saveKnownNodes()
|
||||||
|
|
||||||
|
|
||||||
def readKnownNodes():
|
def readKnownNodes():
|
||||||
try:
|
try:
|
||||||
with open(state.appdata + 'knownnodes.dat', 'rb') as source:
|
with open(state.appdata + 'knownnodes.dat', 'rb') as source:
|
||||||
|
@ -82,6 +100,7 @@ def readKnownNodes():
|
||||||
except (IOError, OSError, KeyError):
|
except (IOError, OSError, KeyError):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'Failed to read nodes from knownnodes.dat', exc_info=True)
|
'Failed to read nodes from knownnodes.dat', exc_info=True)
|
||||||
|
createDefaultKnownNodes()
|
||||||
|
|
||||||
config = BMConfigParser()
|
config = BMConfigParser()
|
||||||
# if config.safeGetInt('bitmessagesettings', 'settingsversion') > 10:
|
# if config.safeGetInt('bitmessagesettings', 'settingsversion') > 10:
|
||||||
|
|
Reference in New Issue
Block a user