Closed
Description
As far as I can tell, plugin authors need to handle 2 separate triggers to shut down our plugins:
- We receive shutdown notification from
lightnignd
. lightningd
stopped and we didn't receiveshutdown
notification. This can be if we read from STDIN and receive 0 bytes.
Having to handle 2 different shutdown triggers complicate plugin code. Ideally plugin authors could pass a single callback to cln_plugin
's plugin builder which would get run in either case. It also took me a long time to understand that I should be handling these 2 cases. Perhaps one explicit shutdown handler would make this clearer. If, for some reason, a plugin wanted to handle these differently, then an enum could be passed as an argument to this callback indicating which case needs handling.