Browse Source
python3.9: sample from list instead of set
electrum/electrum/channel_db.py:357: DeprecationWarning: Sampling from a
set deprecated since Python 3.9 and will be removed in a subsequent version.
patch-4
bitromortac
4 years ago
No known key found for this signature in database
GPG Key ID: 1965063FC13BEBE2
1 changed files with
1 additions and
1 deletions
-
electrum/channel_db.py
|
@ -354,7 +354,7 @@ class ChannelDB(SqlDB): |
|
|
def get_200_randomly_sorted_nodes_not_in(self, node_ids): |
|
|
def get_200_randomly_sorted_nodes_not_in(self, node_ids): |
|
|
with self.lock: |
|
|
with self.lock: |
|
|
unshuffled = set(self._nodes.keys()) - node_ids |
|
|
unshuffled = set(self._nodes.keys()) - node_ids |
|
|
return random.sample(unshuffled, min(200, len(unshuffled))) |
|
|
return random.sample(list(unshuffled), min(200, len(unshuffled))) |
|
|
|
|
|
|
|
|
def get_last_good_address(self, node_id: bytes) -> Optional[LNPeerAddr]: |
|
|
def get_last_good_address(self, node_id: bytes) -> Optional[LNPeerAddr]: |
|
|
"""Returns latest address we successfully connected to, for given node.""" |
|
|
"""Returns latest address we successfully connected to, for given node.""" |
|
|