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

Function opt_subdaemon

lightningd/options.c:367–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367static char *opt_subdaemon(const char *arg, struct lightningd *ld)
368{
369 char *subdaemon;
370 char *sdpath;
371
372 /* example arg: "hsmd:remote_hsmd" */
373
374 size_t colonoff = strcspn(arg, ":");
375 if (!arg[colonoff])
376 return tal_fmt(tmpctx, "argument must contain ':'");
377
378 subdaemon = tal_strndup(ld, arg, colonoff);
379 if (!is_subdaemon(subdaemon))
380 return tal_fmt(tmpctx, "\"%s\" is not a subdaemon", subdaemon);
381
382 /* Make the value a tal-child of the subdaemon */
383 sdpath = tal_strdup(subdaemon, arg + colonoff + 1);
384
385 /* Remove any preexisting alt subdaemon mapping (and
386 * implicitly, the sdpath). */
387 tal_free(strmap_del(&ld->alt_subdaemons, subdaemon, NULL));
388
389 strmap_add(&ld->alt_subdaemons, subdaemon, sdpath);
390
391 return NULL;
392}
393
394static bool opt_show_u64(char *buf, size_t len, const u64 *u)
395{

Callers

nothing calls this directly

Calls 2

is_subdaemonFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected