This repository has been archived on 2024-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-02/src/network/connectionchooser.py

12 lines
255 B
Python
Raw Normal View History

import random
from bmconfigparser import BMConfigParser
import knownnodes
import state
def chooseConnection(stream):
if state.trustedPeer:
return state.trustedPeer
else:
return random.choice(knownnodes.knownNodes[stream].keys())