mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
param: make command_fail/command_success WARN_UNUSED_RESULT.
This causes a compiler warning if we don't do something with the result (hopefully return immediately!). We use was_pending() to ignore the result in the case where we complete a command in a callback (thus really do want to ignore the result). This actually fixes one bug: we didn't return after command_fail in json_getroute with a bad seed value. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -66,16 +66,17 @@ void ping_reply(struct subd *subd, const u8 *msg)
|
||||
assert(pc);
|
||||
|
||||
if (!ok)
|
||||
command_fail(pc->cmd, LIGHTNINGD, "Bad reply message");
|
||||
was_pending(command_fail(pc->cmd, LIGHTNINGD,
|
||||
"Bad reply message"));
|
||||
else if (!sent)
|
||||
command_fail(pc->cmd, LIGHTNINGD, "Unknown peer");
|
||||
was_pending(command_fail(pc->cmd, LIGHTNINGD, "Unknown peer"));
|
||||
else {
|
||||
struct json_stream *response = json_stream_success(pc->cmd);
|
||||
|
||||
json_object_start(response, NULL);
|
||||
json_add_num(response, "totlen", totlen);
|
||||
json_object_end(response);
|
||||
command_success(pc->cmd, response);
|
||||
was_pending(command_success(pc->cmd, response));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user