twhen paying and there are multiple 'r' hints, use one at random - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit a06b49ae40a430c8b197c382c2dc5df6be2e8e3d DIR parent 97393d05aa55a2095b7e6323aa7d4fc5a6014723 HTML Author: SomberNight <somber.night@protonmail.com> Date: Mon, 8 Oct 2018 21:14:56 +0200 when paying and there are multiple 'r' hints, use one at random Diffstat: M electrum/lnworker.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- DIR diff --git a/electrum/lnworker.py b/electrum/lnworker.py t@@ -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)