The helloworld plugin registers a htlc_accepted hook. The hook will sleep for a few seconds and log a message. `lightningd` should wait for the response and only then complete the payment.
(node_factory, executor)
| 398 | |
| 399 | |
| 400 | def test_plugin_hook(node_factory, executor): |
| 401 | """The helloworld plugin registers a htlc_accepted hook. |
| 402 | |
| 403 | The hook will sleep for a few seconds and log a |
| 404 | message. `lightningd` should wait for the response and only then |
| 405 | complete the payment. |
| 406 | |
| 407 | """ |
| 408 | l1, l2 = node_factory.line_graph(2, opts={'plugin': os.path.join(os.getcwd(), 'contrib/plugins/helloworld.py')}) |
| 409 | start_time = time.time() |
| 410 | f = executor.submit(l1.pay, l2, 100000) |
| 411 | l2.daemon.wait_for_log(r'on_htlc_accepted called') |
| 412 | |
| 413 | # The hook will sleep for 20 seconds before answering, so `f` |
| 414 | # should take at least that long. |
| 415 | f.result() |
| 416 | end_time = time.time() |
| 417 | assert(end_time >= start_time + 20) |
| 418 | |
| 419 | |
| 420 | def test_plugin_connect_notifications(node_factory): |
nothing calls this directly
no test coverage detected