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
90468030d5/04-onion-routing.md (basic-multi-part-payments)
This commit is contained in:
@@ -1559,7 +1559,10 @@ class Peer(Logger):
|
|||||||
try:
|
try:
|
||||||
payment_secret_from_onion = processed_onion.hop_data.payload["payment_data"]["payment_secret"]
|
payment_secret_from_onion = processed_onion.hop_data.payload["payment_data"]["payment_secret"]
|
||||||
except:
|
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:
|
else:
|
||||||
if payment_secret_from_onion != derive_payment_secret_from_payment_preimage(preimage):
|
if payment_secret_from_onion != derive_payment_secret_from_payment_preimage(preimage):
|
||||||
raise OnionRoutingFailure(code=OnionFailureCode.INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS, data=b'')
|
raise OnionRoutingFailure(code=OnionFailureCode.INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS, data=b'')
|
||||||
|
|||||||
Reference in New Issue
Block a user