Merge pull request #6740 from bitromortac/lnrater-followup
lnrater: follow-up for save channel db attribute accesses
This commit is contained in:
@@ -762,11 +762,11 @@ class ChannelDB(SqlDB):
|
|||||||
|
|
||||||
def get_node_infos(self) -> Dict[bytes, NodeInfo]:
|
def get_node_infos(self) -> Dict[bytes, NodeInfo]:
|
||||||
with self.lock:
|
with self.lock:
|
||||||
return self._nodes
|
return self._nodes.copy()
|
||||||
|
|
||||||
def get_node_policies(self) -> Dict[Tuple[bytes, ShortChannelID], Policy]:
|
def get_node_policies(self) -> Dict[Tuple[bytes, ShortChannelID], Policy]:
|
||||||
with self.lock:
|
with self.lock:
|
||||||
return self._policies
|
return self._policies.copy()
|
||||||
|
|
||||||
def to_dict(self) -> dict:
|
def to_dict(self) -> dict:
|
||||||
""" Generates a graph representation in terms of a dictionary.
|
""" Generates a graph representation in terms of a dictionary.
|
||||||
|
|||||||
@@ -214,9 +214,11 @@ class LNRater(Logger):
|
|||||||
heuristics = []
|
heuristics = []
|
||||||
heuristics_weights = []
|
heuristics_weights = []
|
||||||
|
|
||||||
# example of how we could construct a scalar score for nodes
|
# Construct an average score which leads to recommendation of nodes
|
||||||
# this is probably not what we want to to, this is roughly
|
# with low fees, large capacity and reasonable number of channels.
|
||||||
# preferential attachment
|
# 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
|
# number of channels
|
||||||
heuristics.append(stats.number_channels / max_num_chan)
|
heuristics.append(stats.number_channels / max_num_chan)
|
||||||
|
|||||||
Reference in New Issue
Block a user