diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 66c5c289a..429b20807 100644 --- a/lightningd/lightningd.c +++ b/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); diff --git a/lightningd/test/run-find_my_path.c b/lightningd/test/run-find_my_path.c index f6a3db300..6eca73222 100644 --- a/lightningd/test/run-find_my_path.c +++ b/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(); }