Browse Source

trampoline: forwarding, use correct secret for legacy case

patch-4
bitromortac 4 years ago
parent
commit
a3ec3f3228
No known key found for this signature in database GPG Key ID: 1965063FC13BEBE2
  1. 7
      electrum/lnpeer.py
  2. 4
      electrum/trampoline.py

7
electrum/lnpeer.py

@ -1443,7 +1443,12 @@ class Peer(Logger):
payload = trampoline_onion.hop_data.payload
payment_hash = htlc.payment_hash
payment_secret = os.urandom(32)
payment_data = payload.get('payment_data')
if payment_data: # legacy case
payment_secret = payment_data['payment_secret']
else:
payment_secret = os.urandom(32)
try:
outgoing_node_id = payload["outgoing_node_id"]["outgoing_node_id"]
amt_to_forward = payload["amt_to_forward"]["amt_to_forward"]

4
electrum/trampoline.py

@ -247,7 +247,7 @@ def create_trampoline_onion(*, route, amount_msat, final_cltv, total_msat, payme
# only for final
if i == num_hops - 1:
payload["payment_data"] = {
"payment_secret":payment_secret,
"payment_secret": payment_secret,
"total_msat": total_msat
}
# legacy
@ -255,7 +255,7 @@ def create_trampoline_onion(*, route, amount_msat, final_cltv, total_msat, payme
payload["invoice_features"] = {"invoice_features":route_edge.invoice_features}
payload["invoice_routing_info"] = {"invoice_routing_info":route_edge.invoice_routing_info}
payload["payment_data"] = {
"payment_secret":payment_secret,
"payment_secret": payment_secret,
"total_msat": total_msat
}
_logger.info(f'payload {i} {payload}')

Loading…
Cancel
Save