MCPcopy Create free account
hub / github.com/ElementsProject/lightning / next_bcli

Function next_bcli

plugins/bcli.c:292–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292static void next_bcli(enum bitcoind_prio prio)
293{
294 struct bitcoin_cli *bcli;
295 struct io_conn *conn;
296 int in;
297
298 if (bitcoind->num_requests[prio] >= BITCOIND_MAX_PARALLEL)
299 return;
300
301 bcli = list_pop(&bitcoind->pending[prio], struct bitcoin_cli, list);
302 if (!bcli)
303 return;
304
305 bcli->pid = pipecmdarr(&in, &bcli->fd, &bcli->fd,
306 cast_const2(char **, bcli->args));
307
308 if (bitcoind->rpcpass)
309 write_all(in, bitcoind->rpcpass, strlen(bitcoind->rpcpass));
310
311 close(in);
312
313 if (bcli->pid < 0)
314 plugin_err(bcli->cmd->plugin, "%s exec failed: %s",
315 bcli->args[0], strerror(errno));
316
317 bcli->start = time_now();
318
319 bitcoind->num_requests[prio]++;
320
321 /* We don't keep a pointer to this, but it's not a leak */
322 conn = notleak(io_new_conn(bcli, bcli->fd, output_init, bcli));
323 io_set_finish(conn, bcli_finished, bcli);
324
325 list_add_tail(&bitcoind->current, &bcli->list);
326 tal_add_destructor(bcli, destroy_bcli);
327}
328
329static void
330start_bitcoin_cliv(const tal_t *ctx,

Callers 3

retry_bcliFunction · 0.85
bcli_finishedFunction · 0.85
start_bitcoin_clivFunction · 0.85

Calls 4

pipecmdarrFunction · 0.85
time_nowFunction · 0.85
plugin_errFunction · 0.70
write_allFunction · 0.50

Tested by

no test coverage detected