lightningd: generically fail requests when plugin dies.

We had special code to fail a forwarded request, but not for an
internally-generated request.  Instead, we should pretend the (dead)
plugin responded with a PLUGIN_TERMINATED error, and handle the
request through the normal paths.

This breaks the case where a plugin crashes (or stops itself) in a
hook, so we handle that next.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-10-24 12:11:29 +10:30
parent 8170aba75f
commit 22ea202ae3
3 changed files with 58 additions and 37 deletions

View File

@@ -76,10 +76,6 @@ struct plugin {
/* Currently pending requests by their request ID */
STRMAP(struct jsonrpc_request *) pending_requests;
/* An array of currently pending RPC method calls, to be killed if the
* plugin exits. */
struct list_head pending_rpccalls;
/* If set, the plugin is so important that if it terminates early,
* C-lightning should terminate as well. */
bool important;