mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
daemon: test restarting.
We add a "dev-restart" command which causes the daemon to close fds and exec itself. Then we do it after every command, with the caveat that we always send a commit before newhtlc, because if not committed, that is forgotten. Fulfillhtlc and failhtlc get resent, since they're idempotent. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -77,3 +77,22 @@ void opt_show_time(char buf[OPT_SHOW_LEN], const struct timerel *t)
|
||||
} else
|
||||
sprintf(buf, "%lus", t->ts.tv_sec);
|
||||
}
|
||||
|
||||
char *opt_set_timeabs(const char *arg, struct timeabs *t)
|
||||
{
|
||||
long double d;
|
||||
|
||||
if (sscanf(arg, "%Lf", &d) != 1)
|
||||
return tal_fmt(NULL, "'%s' is not a time", arg);
|
||||
t->ts.tv_sec = d;
|
||||
t->ts.tv_nsec = (d - t->ts.tv_sec) * 1000000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void opt_show_timeabs(char buf[OPT_SHOW_LEN], const struct timeabs *t)
|
||||
{
|
||||
long double d = t->ts.tv_sec;
|
||||
d = d * 1000000000 + t->ts.tv_nsec;
|
||||
|
||||
sprintf(buf, "%.9Lf", d);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user