Browse Source

lightningd: insert db statement checking in io_loop.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
91d149b990
  1. 12
      lightningd/lightningd.c
  2. 3
      lightningd/test/run-find_my_path.c

12
lightningd/lightningd.c

@ -278,6 +278,15 @@ static void pidfile_create(const struct lightningd *ld)
write_all(pid_fd, pid, strlen(pid));
}
/* Yuck, we need globals here. */
static int (*io_poll_debug)(struct pollfd *, nfds_t, int);
static int io_poll_lightningd(struct pollfd *fds, nfds_t nfds, int timeout)
{
db_assert_no_outstanding_statements();
return io_poll_debug(fds, nfds, timeout);
}
int main(int argc, char *argv[])
{
setup_locale();
@ -310,6 +319,9 @@ int main(int argc, char *argv[])
ld->owned_txfilter = txfilter_new(ld);
ld->topology->wallet = ld->wallet;
/* We do extra checks in io_loop. */
io_poll_debug = io_poll_override(io_poll_lightningd);
/* Set up HSM. */
hsm_init(ld, newdir);

3
lightningd/test/run-find_my_path.c

@ -18,6 +18,9 @@ void daemon_setup(const char *argv0 UNNEEDED,
/* Generated stub for daemon_shutdown */
void daemon_shutdown(void)
{ fprintf(stderr, "daemon_shutdown called!\n"); abort(); }
/* Generated stub for db_assert_no_outstanding_statements */
void db_assert_no_outstanding_statements(void)
{ fprintf(stderr, "db_assert_no_outstanding_statements called!\n"); abort(); }
/* Generated stub for db_begin_transaction_ */
void db_begin_transaction_(struct db *db UNNEEDED, const char *location UNNEEDED)
{ fprintf(stderr, "db_begin_transaction_ called!\n"); abort(); }

Loading…
Cancel
Save