From 83dcc5e4cc4c776adb732d8ac97ba8c352a1d38a Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 26 Jul 2023 18:52:12 +0200 Subject: [PATCH] payment bundles: fix bundle detection for trampoline This feels a bit like workaround; it might be better to represent payment bundles objects using payment secrets rather than payment hashes. --- electrum/lnworker.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index aa1c44f22..33acb0d00 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -1935,8 +1935,14 @@ class LNWallet(LNWorker): is_expired, is_accepted = self.get_mpp_status(payment_secret) if not is_accepted and not is_expired: bundle = self.get_payment_bundle(payment_hash) - payment_hashes = bundle or [payment_hash] - payment_secrets = [self.get_payment_secret(h) for h in bundle] if bundle else [payment_secret] + if bundle: + payment_secrets = [self.get_payment_secret(h) for h in bundle] + if payment_secret not in payment_secrets: + # outer trampoline onion secret differs from inner onion + # the latter, not the former, might be part of a bundle + payment_secrets = [payment_secret] + else: + payment_secrets = [payment_secret] first_timestamp = min([self.get_first_timestamp_of_mpp(x) for x in payment_secrets]) if self.get_payment_status(payment_hash) == PR_PAID: is_accepted = True