Check that a notification is triggered when a node receives a custommsg. We'll send a message from l2 to l1 and verify that l1 received the appropriate notification
(node_factory)
| 2981 | |
| 2982 | |
| 2983 | def test_custommsg_triggers_notification(node_factory): |
| 2984 | """Check that a notification is triggered when a node receives |
| 2985 | a custommsg. |
| 2986 | |
| 2987 | We'll send a message from l2 to l1 and verify that l1 received |
| 2988 | the appropriate notification |
| 2989 | """ |
| 2990 | plugin_path = os.path.join(os.path.dirname(__file__), "plugins", "custommsg_notification.py") |
| 2991 | l1: LightningNode = node_factory.get_node(options={"plugin": plugin_path}) |
| 2992 | l2: LightningNode = node_factory.get_node() |
| 2993 | |
| 2994 | # Connect l1 to l2 |
| 2995 | l1.connect(l2) |
| 2996 | wait_for(lambda: [p['connected'] for p in l2.rpc.listpeers(l1.info['id'])['peers']] == [True]) |
| 2997 | |
| 2998 | # Send a custommsg from l2 to l1 |
| 2999 | # The message id 7777 is chosen to be sufficiently high and shouldn't be used by the |
| 3000 | # lightning spec |
| 3001 | l2.rpc.sendcustommsg(l1.info['id'], "77770012") |
| 3002 | |
| 3003 | # TODO: Check if the peer_id and payload matches |
| 3004 | peer_id = l2.info["id"] |
| 3005 | l1.daemon.wait_for_log(f"Received a custommsg with data") |
| 3006 | l1.daemon.wait_for_log(f"peer_id={peer_id}") |
| 3007 | l1.daemon.wait_for_log(f"payload=77770012") |
| 3008 | |
| 3009 | |
| 3010 | def test_makesecret(node_factory): |
nothing calls this directly
no test coverage detected