MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / knownNodes

Function knownNodes

src/helper_bootstrap.py:23–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21
22
23def knownNodes():
24 try:
25 with open(state.appdata + 'knownnodes.dat', 'rb') as pickleFile:
26 with knownnodes.knownNodesLock:
27 knownnodes.knownNodes = pickle.load(pickleFile)
28 # the old format was {Peer:lastseen, ...}
29 # the new format is {Peer:{"lastseen":i, "rating":f}}
30 for stream in knownnodes.knownNodes.keys():
31 for node, params in knownnodes.knownNodes[stream].items():
32 if isinstance(params, (float, int)):
33 addKnownNode(stream, node, params)
34 except:
35 knownnodes.knownNodes = defaultKnownNodes.createDefaultKnownNodes(state.appdata)
36 # your own onion address, if setup
37 if BMConfigParser().has_option('bitmessagesettings', 'onionhostname') and ".onion" in BMConfigParser().get('bitmessagesettings', 'onionhostname'):
38 addKnownNode(1, state.Peer(BMConfigParser().get('bitmessagesettings', 'onionhostname'), BMConfigParser().getint('bitmessagesettings', 'onionport')), self=True)
39 if BMConfigParser().getint('bitmessagesettings', 'settingsversion') > 10:
40 logger.error('Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.')
41 raise SystemExit
42
43
44def dns():

Callers

nothing calls this directly

Calls 4

BMConfigParserClass · 0.90
addKnownNodeFunction · 0.85
itemsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected