MCPcopy Create free account
hub / github.com/ElementsProject/lightning / on_htlc_accepted

Function on_htlc_accepted

tests/plugins/accept_payment_metadata.py:21–28  ·  view source on GitHub ↗
(onion, plugin, **kwargs)

Source from the content-addressed store, hash-verified

19
20@plugin.hook("htlc_accepted")
21def on_htlc_accepted(onion, plugin, **kwargs):
22 if plugin.expect is None or 'payment_metadata' not in onion:
23 return {'result': 'continue'}
24 preimage, metadata = plugin.expect
25 if onion['payment_metadata'] != metadata:
26 plugin.log(f"Unexpected metadata {onion['payment_metadata']}", level='broken')
27 return {'result': 'continue'}
28 return {'result': 'resolve', 'payment_key': preimage}
29
30
31plugin.expect = None

Callers

nothing calls this directly

Calls 1

logMethod · 0.80

Tested by

no test coverage detected