1
0

lnworker._pay: allow specifying path as argument

not exposed to CLI/etc yet but will be used in tests soon
This commit is contained in:
SomberNight
2020-05-06 10:56:33 +02:00
parent 63b18dc30f
commit 7153e753d1
4 changed files with 50 additions and 13 deletions

View File

@@ -119,7 +119,7 @@ class Policy(NamedTuple):
return ShortChannelID.normalize(self.key[0:8])
@property
def start_node(self):
def start_node(self) -> bytes:
return self.key[8:]
@@ -732,5 +732,18 @@ class ChannelDB(SqlDB):
relevant_channels.add(chan.short_channel_id)
return relevant_channels
def get_endnodes_for_chan(self, short_channel_id: ShortChannelID, *,
my_channels: Dict[ShortChannelID, 'Channel'] = None) -> Optional[Tuple[bytes, bytes]]:
channel_info = self.get_channel_info(short_channel_id)
if channel_info is not None: # publicly announced channel
return channel_info.node1_id, channel_info.node2_id
# check if it's one of our own channels
if not my_channels:
return
chan = my_channels.get(short_channel_id) # type: Optional[Channel]
if not chan:
return
return chan.get_local_pubkey(), chan.node_id
def get_node_info_for_node_id(self, node_id: bytes) -> Optional['NodeInfo']:
return self._nodes.get(node_id)