electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 9024419fdcd78dc3740c544cf81578c18ac87f02
parent 691ebaf4f816b45ca10eabceae3068b7465e6bc5
Author: SomberNight <somber.night@protonmail.com>
Date:   Wed, 24 Feb 2021 20:34:34 +0100

lnpeer: MPP receive: require payment_secret for each htlc

BOLT-04 says:
The final node:
  if it supports basic_mpp:
    MUST require payment_secret for all HTLCs in the set

https://github.com/lightningnetwork/lightning-rfc/blob/90468030d5c374ced568c91df5d37699fe020010/04-onion-routing.md#basic-multi-part-payments

Diffstat:
Melectrum/lnpeer.py | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py @@ -1559,7 +1559,10 @@ class Peer(Logger): try: payment_secret_from_onion = processed_onion.hop_data.payload["payment_data"]["payment_secret"] except: - pass # skip + if total_msat > amt_to_forward: + # payment_secret is required for MPP + raise OnionRoutingFailure(code=OnionFailureCode.INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS, data=b'') + # TODO fail here if invoice has set PAYMENT_SECRET_REQ else: if payment_secret_from_onion != derive_payment_secret_from_payment_preimage(preimage): raise OnionRoutingFailure(code=OnionFailureCode.INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS, data=b'')