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

Function on_htlc_accepted

tests/plugins/hold_htlcs.py:18–34  ·  view source on GitHub ↗
(htlc, onion, plugin, **kwargs)

Source from the content-addressed store, hash-verified

16
17@plugin.hook("htlc_accepted")
18def on_htlc_accepted(htlc, onion, plugin, **kwargs):
19 # Stash the onion so the test can check it
20 fname = os.path.join(tempfile.mkdtemp(), "onion.json")
21 with open(fname, 'w') as f:
22 f.write(json.dumps(onion))
23
24 plugin.log("Holding onto an incoming htlc for {hold_time} seconds".format(
25 hold_time=plugin.hold_time
26 ))
27
28 time.sleep(plugin.hold_time)
29
30 print("Onion written to {}".format(fname))
31
32 # Give the tester something to look for
33 plugin.log("htlc_accepted hook called")
34 return {'result': plugin.hold_result}
35
36
37plugin.add_option(

Callers

nothing calls this directly

Calls 3

joinMethod · 0.80
logMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected