Browse Source

Merge pull request #6740 from bitromortac/lnrater-followup

lnrater: follow-up for save channel db attribute accesses
patch-4
ghost43 4 years ago
committed by GitHub
parent
commit
5f39a2f29c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      electrum/channel_db.py
  2. 8
      electrum/lnrater.py

4
electrum/channel_db.py

@ -762,11 +762,11 @@ class ChannelDB(SqlDB):
def get_node_infos(self) -> Dict[bytes, NodeInfo]:
with self.lock:
return self._nodes
return self._nodes.copy()
def get_node_policies(self) -> Dict[Tuple[bytes, ShortChannelID], Policy]:
with self.lock:
return self._policies
return self._policies.copy()
def to_dict(self) -> dict:
""" Generates a graph representation in terms of a dictionary.

8
electrum/lnrater.py

@ -214,9 +214,11 @@ class LNRater(Logger):
heuristics = []
heuristics_weights = []
# example of how we could construct a scalar score for nodes
# this is probably not what we want to to, this is roughly
# preferential attachment
# Construct an average score which leads to recommendation of nodes
# with low fees, large capacity and reasonable number of channels.
# This is somewhat akin to preferential attachment, but low fee
# nodes are more favored. Here we make a compromise between user
# comfort and decentralization, tending towards user comfort.
# number of channels
heuristics.append(stats.number_channels / max_num_chan)

Loading…
Cancel
Save