Files
lightning/tests/plugins/forward_payment_status.py
Rusty Russell 20a2bf9547 pytest: make test_forward_event_notification more explicit.
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>
2019-08-28 04:04:28 +00:00

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()