mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-12-28 01:24:42 +01:00
3e3b05e1b2
`pylightning` is not much more than an alias for `pyln-client`, so this removes the need to install that as well just to run the tests.
31 lines
672 B
Python
Executable File
31 lines
672 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""This plugin is used to check that async method calls are working correctly.
|
|
|
|
The plugin registers a method `callme` with an argument. All calls are
|
|
stashed away, and are only resolved on the fifth invocation. All calls
|
|
will then return the argument of the fifth call.
|
|
|
|
"""
|
|
from pyln.client import Plugin
|
|
|
|
plugin = Plugin()
|
|
|
|
|
|
@plugin.init()
|
|
def init(configuration, options, plugin):
|
|
plugin.requests = []
|
|
|
|
|
|
@plugin.async_method('asyncqueue')
|
|
def async_queue(request, plugin):
|
|
plugin.requests.append(request)
|
|
|
|
|
|
@plugin.method('asyncflush')
|
|
def async_flush(res, plugin):
|
|
for r in plugin.requests:
|
|
r.set_result(res)
|
|
|
|
|
|
plugin.run()
|