lightningd: insert db statement checking in io_loop.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-04-27 11:11:38 +09:30
committed by Christian Decker
parent 0f0c045aca
commit 91d149b990
2 changed files with 15 additions and 0 deletions

View File

@@ -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);

View File

@@ -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(); }