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:
Rusty Russell
2018-12-16 15:23:06 +10:30
parent 68bb36b210
commit 819078fe18
15 changed files with 160 additions and 135 deletions

View File

@@ -245,7 +245,7 @@ static void connect_failed(struct lightningd *ld, const u8 *msg)
/* We can have multiple connect commands: fail them all */
while ((c = find_connect(ld, &id)) != NULL) {
/* They delete themselves from list */
command_fail(c->cmd, LIGHTNINGD, "%s", err);
was_pending(command_fail(c->cmd, LIGHTNINGD, "%s", err));
}
/* If we have an active channel, then reconnect. */