mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
We seem to be getting intermittant failures, but it's hard to disgnose. Simplify it by moving all the test logic into the test itself, and making the plugin dumber. This means we'll see exactly what the differences are if it fails again. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
28 lines
797 B
Python
Executable File
28 lines
797 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""This plugin is used to check that forward_event calls are working correctly.
|
|
"""
|
|
from lightning import Plugin
|
|
|
|
plugin = Plugin()
|
|
|
|
|
|
@plugin.init()
|
|
def init(configuration, options, plugin):
|
|
plugin.forward_list = []
|
|
|
|
|
|
@plugin.subscribe("forward_event")
|
|
def notify_warning(plugin, forward_event):
|
|
# One forward payment may have many notification records for different status,
|
|
# but one forward payment has only one record in 'listforwards' eventrually.
|
|
plugin.log("receive a forward recored, status: {}, payment_hash: {}".format(forward_event['status'], forward_event['payment_hash']))
|
|
plugin.forward_list.append(forward_event)
|
|
|
|
|
|
@plugin.method('listforwards_plugin')
|
|
def record_lookup(plugin):
|
|
return {'forwards': plugin.forward_list}
|
|
|
|
|
|
plugin.run()
|