spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.23k stars 3.03k forks source link

Fix swapserver trampoline #8924

Closed ecdsa closed 4 months ago

ecdsa commented 4 months ago
lnpeer: fix #8825

In maybe_fulfill_htlc, return two items: (preimage, (payment_key, callback)).

Rationale: The caller needs a payment_key only if we return a callback.
If we do not, the caller should use the payment_key that was previously
stored in channel.unfulfilled_htlcs

Note that for trampoline onions, payment_key may contain the inner
or outer secret.
SomberNight commented 4 months ago

some comments for now but will think a bit more about this

Ok, I think the change is logically correct. Though this part of the code (process_unfulfilled_htlc and friends) is a bit hard to review...