commit 5f39a2f29c0529f3eed798240e6373bc18e2d650
parent 59e9337be07bbc5439a4ceedaddf4d163e9c0fa2
Author: ghost43 <somber.night@protonmail.com>
Date: Tue, 17 Nov 2020 16:05:18 +0000
Merge pull request #6740 from bitromortac/lnrater-followup
lnrater: follow-up for save channel db attribute accesses
Diffstat:
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/electrum/channel_db.py b/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.
diff --git a/electrum/lnrater.py b/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)