tMerge pull request #6740 from bitromortac/lnrater-followup - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 5f39a2f29c0529f3eed798240e6373bc18e2d650 DIR parent 59e9337be07bbc5439a4ceedaddf4d163e9c0fa2 HTML 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: M electrum/channel_db.py | 4 ++-- M electrum/lnrater.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) --- DIR diff --git a/electrum/channel_db.py b/electrum/channel_db.py t@@ -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. DIR diff --git a/electrum/lnrater.py b/electrum/lnrater.py t@@ -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)