lightningd: don't re-enter transaction if we have to call plugin_exclusive_loop.

```
Already in transaction from lightningd/plugin.c:727
```

There are two callers, and one didn't disable transactions, so do it in plugin_exclusive_loop.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-10-25 10:14:21 +10:30 committed by Vincenzo Palazzo
parent eeee5d6249
commit 9c5e364f16
2 changed files with 3 additions and 3 deletions

View file

@ -2391,8 +2391,11 @@ void *plugins_exclusive_loop(struct plugin **plugins)
io_conn_exclusive(plugins[i]->stdout_conn, true);
}
/* We don't want to try to open another transaction: we're in one! */
plugins[0]->plugins->want_db_transaction = false;
/* We don't service timers here, either! */
ret = io_loop(NULL, NULL);
plugins[0]->plugins->want_db_transaction = true;
log_debug(plugins[0]->plugins->ld->log, "io_loop: %s", __func__);
for (i = 0; i < tal_count(plugins); ++i) {

View file

@ -360,10 +360,7 @@ void plugin_hook_db_sync(struct db *db)
plugin_request_send(plugin_arr[i], req);
}
/* We don't want to try to open another transaction: we're in one! */
plugins->want_db_transaction = false;
ret = plugins_exclusive_loop(plugin_arr);
plugins->want_db_transaction = true;
/* We can be called on way out of an io_loop, which is already breaking.
* That will make this immediately return; save the break value and call