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

Function on_htlc_accepted

tests/plugins/hook-chain-odd.py:12–21  ·  view source on GitHub ↗
(htlc, plugin, **kwargs)

Source from the content-addressed store, hash-verified

10
11@plugin.hook('htlc_accepted')
12def on_htlc_accepted(htlc, plugin, **kwargs):
13 preimage = b"\xAA" * 32
14 payment_hash = sha256(preimage).hexdigest()
15 preimage = hexlify(preimage).decode('ASCII')
16 print("htlc_accepted called for payment_hash {}".format(htlc['payment_hash']))
17
18 if htlc['payment_hash'] == payment_hash:
19 return {'result': 'resolve', 'payment_key': preimage}
20 else:
21 return {'result': 'continue'}
22
23
24plugin.run()

Callers

nothing calls this directly

Calls 3

hexlifyFunction · 0.85
sha256Class · 0.70
decodeMethod · 0.45

Tested by

no test coverage detected