mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
when paying and there are multiple 'r' hints, use one at random
This commit is contained in:
parent
97393d05aa
commit
a06b49ae40
1 changed files with 8 additions and 3 deletions
|
@ -259,9 +259,14 @@ class LNWorker(PrintError):
|
|||
invoice_pubkey = decoded_invoice.pubkey.serialize()
|
||||
# use 'r' field from invoice
|
||||
route = None # type: List[RouteEdge]
|
||||
for tag_type, data in decoded_invoice.tags:
|
||||
if tag_type != 'r': continue
|
||||
private_route = data
|
||||
# only want 'r' tags
|
||||
r_tags = list(filter(lambda x: x[0] == 'r', decoded_invoice.tags))
|
||||
# strip the tag type, it's implicitly 'r' now
|
||||
r_tags = list(map(lambda x: x[1], r_tags))
|
||||
# if there are multiple hints, we will use the first one that works,
|
||||
# from a random permutation
|
||||
random.shuffle(r_tags)
|
||||
for private_route in r_tags:
|
||||
if len(private_route) == 0: continue
|
||||
border_node_pubkey = private_route[0][0]
|
||||
path = self.network.path_finder.find_path_for_payment(self.node_keypair.pubkey, border_node_pubkey, amount_msat)
|
||||
|
|
Loading…
Add table
Reference in a new issue