示例#1
0
def knownNodes():
    try:
        # We shouldn't have to use the shared.knownNodesLock because this had
        # better be the only thread accessing knownNodes right now.
        pickleFile = open(shared.appdata + 'knownnodes.dat', 'rb')
        shared.knownNodes = pickle.load(pickleFile)
        pickleFile.close()
    except:
        defaultKnownNodes.createDefaultKnownNodes(shared.appdata)
        pickleFile = open(shared.appdata + 'knownnodes.dat', 'rb')
        shared.knownNodes = pickle.load(pickleFile)
        pickleFile.close()
    if shared.config.getint('bitmessagesettings', 'settingsversion') > 6:
        print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.'
        raise SystemExit
示例#2
0
def knownNodes():
    try:
        # We shouldn't have to use the shared.knownNodesLock because this had
        # better be the only thread accessing knownNodes right now.
        pickleFile = open(shared.appdata + 'knownnodes.dat', 'rb')
        loadedKnownNodes = pickle.load(pickleFile)
        pickleFile.close()
        # The old format of storing knownNodes was as a 'host: (port, time)'
        # mapping. The new format is as 'Peer: time' pairs. If we loaded
        # data in the old format, transform it to the new style.
        for stream, nodes in loadedKnownNodes.items():
            shared.knownNodes[stream] = {}
            for node_tuple in nodes.items():
                try:
                    host, (port, time) = node_tuple
                    peer = shared.Peer(host, port)
                except:
                    peer, time = node_tuple
                shared.knownNodes[stream][peer] = time
    except:
        shared.knownNodes = defaultKnownNodes.createDefaultKnownNodes(shared.appdata)
    if shared.config.getint('bitmessagesettings', 'settingsversion') > 10:
        logger.error('Bitmessage cannot read future versions ' +
                     'of the keys file (keys.dat). Run the newer ' +
                     'version of Bitmessage.')
        raise SystemExit
示例#3
0
def knownNodes():
    try:
        # We shouldn't have to use the shared.knownNodesLock because this had
        # better be the only thread accessing knownNodes right now.
        pickleFile = open(shared.appdata + 'knownnodes.dat', 'rb')
        loadedKnownNodes = pickle.load(pickleFile)
        pickleFile.close()
        # The old format of storing knownNodes was as a 'host: (port, time)'
        # mapping. The new format is as 'Peer: time' pairs. If we loaded
        # data in the old format, transform it to the new style.
        for stream, nodes in loadedKnownNodes.items():
            shared.knownNodes[stream] = {}
            for node_tuple in nodes.items():
                try:
                    host, (port, time) = node_tuple
                    peer = shared.Peer(host, port)
                except:
                    peer, time = node_tuple
                shared.knownNodes[stream][peer] = time
    except:
        shared.knownNodes = defaultKnownNodes.createDefaultKnownNodes(
            shared.appdata)
    if shared.config.getint('bitmessagesettings', 'settingsversion') > 8:
        print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.'
        raise SystemExit
示例#4
0
def knownNodes():
    try:
        # We shouldn't have to use the shared.knownNodesLock because this had
        # better be the only thread accessing knownNodes right now.
        pickleFile = open(shared.appdata + 'knownnodes.dat', 'rb')
        loadedKnownNodes = pickle.load(pickleFile)
        pickleFile.close()
        # The old format of storing knownNodes was as a 'host: (port, time)'
        # mapping. The new format is as 'Peer: time' pairs. If we loaded
        # data in the old format, transform it to the new style.
        for stream, nodes in loadedKnownNodes.items():
            shared.knownNodes[stream] = {}
            for node_tuple in nodes.items():
                try:
                    host, (port, lastseen) = node_tuple
                    peer = shared.Peer(host, port)
                except:
                    peer, lastseen = node_tuple
                shared.knownNodes[stream][peer] = lastseen
    except:
        shared.knownNodes = defaultKnownNodes.createDefaultKnownNodes(shared.appdata)
    # your own onion address, if setup
    if shared.config.has_option('bitmessagesettings', 'onionhostname') and ".onion" in shared.config.get('bitmessagesettings', 'onionhostname'):
        shared.knownNodes[1][shared.Peer(shared.config.get('bitmessagesettings', 'onionhostname'), shared.config.getint('bitmessagesettings', 'onionport'))] = int(time.time())
    if shared.config.getint('bitmessagesettings', 'settingsversion') > 10:
        logger.error('Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.')
        raise SystemExit
示例#5
0
def knownNodes():
    try:
        with open(state.appdata + 'knownnodes.dat', 'rb') as pickleFile:
            with knownnodes.knownNodesLock:
                knownnodes.knownNodes = pickle.load(pickleFile)
            # the old format was {Peer:lastseen, ...}
            # the new format is {Peer:{"lastseen":i, "rating":f}}
            for stream in knownnodes.knownNodes.keys():
                for node, params in knownnodes.knownNodes[stream].items():
                    if isinstance(params, (float, int)):
                        addKnownNode(stream, node, params)
    except:
        knownnodes.knownNodes = defaultKnownNodes.createDefaultKnownNodes(
            state.appdata)
    # your own onion address, if setup
    if BMConfigParser().has_option(
            'bitmessagesettings',
            'onionhostname') and ".onion" in BMConfigParser().get(
                'bitmessagesettings', 'onionhostname'):
        addKnownNode(1,
                     state.Peer(
                         BMConfigParser().get('bitmessagesettings',
                                              'onionhostname'),
                         BMConfigParser().getint('bitmessagesettings',
                                                 'onionport')),
                     self=True)
    if BMConfigParser().getint('bitmessagesettings', 'settingsversion') > 10:
        logger.error(
            'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.'
        )
        raise SystemExit
def knownNodes():
    try:
        # We shouldn't have to use the shared.knownNodesLock because this had
        # better be the only thread accessing knownNodes right now.
        pickleFile = open(shared.appdata + 'knownnodes.dat', 'rb')
        loadedKnownNodes = pickle.load(pickleFile)
        pickleFile.close()

        for stream, nodes in loadedKnownNodes.items():
            shared.knownNodes[stream] = {}
            for node_tuple in nodes.items():
                peer, time = node_tuple
                shared.knownNodes[stream][peer] = time
    except:
        shared.knownNodes = defaultKnownNodes.createDefaultKnownNodes(shared.appdata)
    if shared.config.getint('bitmessagesettings', 'settingsversion') > 10:
        print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.'
        raise SystemExit
def knownNodes():
    try:
        with open(state.appdata + 'knownnodes.dat', 'rb') as pickleFile:
            with knownnodes.knownNodesLock:
                knownnodes.knownNodes = pickle.load(pickleFile)
            # the old format was {Peer:lastseen, ...}
            # the new format is {Peer:{"lastseen":i, "rating":f}}
            for stream in knownnodes.knownNodes.keys():
                for node, params in knownnodes.knownNodes[stream].items():
                    if isinstance(params, (float, int)):
                        addKnownNode(stream, node, params)
    except:
        knownnodes.knownNodes = defaultKnownNodes.createDefaultKnownNodes(state.appdata)
    # your own onion address, if setup
    if BMConfigParser().has_option('bitmessagesettings', 'onionhostname') and ".onion" in BMConfigParser().get('bitmessagesettings', 'onionhostname'):
        addKnownNode(1, state.Peer(BMConfigParser().get('bitmessagesettings', 'onionhostname'), BMConfigParser().getint('bitmessagesettings', 'onionport')), self=True)
    if BMConfigParser().getint('bitmessagesettings', 'settingsversion') > 10:
        logger.error('Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.')
        raise SystemExit
示例#8
0
def knownNodes():
    try:
        # We shouldn't have to use the shared.knownNodesLock because this had
        # better be the only thread accessing knownNodes right now.
        pickleFile = open(shared.appdata + 'knownnodes.dat', 'rb')
        loadedKnownNodes = pickle.load(pickleFile)
        pickleFile.close()
        # The old format of storing knownNodes was as a 'host: (port, time)'
        # mapping. The new format is as 'Peer: time' pairs. If we loaded
        # data in the old format, transform it to the new style.
        for stream, nodes in loadedKnownNodes.items():
            shared.knownNodes[stream] = {}
            for node_tuple in nodes.items():
                try:
                    host, (port, time) = node_tuple
                    peer = shared.Peer(host, port)
                except:
                    peer, time = node_tuple
                shared.knownNodes[stream][peer] = time
    except:
        shared.knownNodes = defaultKnownNodes.createDefaultKnownNodes(
            shared.appdata)