mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
libplugin: ignore incoming notifications.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -447,13 +447,18 @@ static const jsmntok_t *read_rpc_reply(const tal_t *ctx,
|
|||||||
{
|
{
|
||||||
const jsmntok_t *toks;
|
const jsmntok_t *toks;
|
||||||
|
|
||||||
|
do {
|
||||||
*reqlen = read_json_from_rpc(plugin);
|
*reqlen = read_json_from_rpc(plugin);
|
||||||
|
|
||||||
toks = json_parse_simple(ctx,
|
toks = json_parse_simple(ctx,
|
||||||
membuf_elems(&plugin->rpc_conn->mb), *reqlen);
|
membuf_elems(&plugin->rpc_conn->mb),
|
||||||
|
*reqlen);
|
||||||
if (!toks)
|
if (!toks)
|
||||||
plugin_err(plugin, "Malformed JSON reply '%.*s'",
|
plugin_err(plugin, "Malformed JSON reply '%.*s'",
|
||||||
*reqlen, membuf_elems(&plugin->rpc_conn->mb));
|
*reqlen, membuf_elems(&plugin->rpc_conn->mb));
|
||||||
|
/* FIXME: Don't simply ignore notifications here! */
|
||||||
|
} while (!json_get_member(membuf_elems(&plugin->rpc_conn->mb), toks,
|
||||||
|
"id"));
|
||||||
|
|
||||||
*contents = json_get_member(membuf_elems(&plugin->rpc_conn->mb), toks, "error");
|
*contents = json_get_member(membuf_elems(&plugin->rpc_conn->mb), toks, "error");
|
||||||
if (*contents)
|
if (*contents)
|
||||||
@@ -525,9 +530,9 @@ static void handle_rpc_reply(struct plugin *plugin, const jsmntok_t *toks)
|
|||||||
|
|
||||||
idtok = json_get_member(plugin->rpc_buffer, toks, "id");
|
idtok = json_get_member(plugin->rpc_buffer, toks, "id");
|
||||||
if (!idtok)
|
if (!idtok)
|
||||||
plugin_err(plugin, "JSON reply without id '%.*s'",
|
/* FIXME: Don't simply ignore notifications! */
|
||||||
json_tok_full_len(toks),
|
return;
|
||||||
json_tok_full(plugin->rpc_buffer, toks));
|
|
||||||
if (!json_to_u64(plugin->rpc_buffer, idtok, &id))
|
if (!json_to_u64(plugin->rpc_buffer, idtok, &id))
|
||||||
plugin_err(plugin, "JSON reply without numeric id '%.*s'",
|
plugin_err(plugin, "JSON reply without numeric id '%.*s'",
|
||||||
json_tok_full_len(toks),
|
json_tok_full_len(toks),
|
||||||
|
|||||||
Reference in New Issue
Block a user