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

Function enable_notifications

cli/lightning-cli.c:563–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561}
562
563static void enable_notifications(int fd)
564{
565 const char *enable;
566 char rbuf[100];
567
568 enable = tal_fmt(tmpctx,
569 "{\"jsonrpc\":\"2.0\","
570 "\"method\":\"notifications\","
571 "\"id\":\"cli:notifications#%i\","
572 "\"params\":{\"enable\":true}}",
573 getpid());
574 if (!write_all(fd, enable, strlen(enable)))
575 err(ERROR_TALKING_TO_LIGHTNINGD, "Writing enable command");
576
577 /* We get a very simple response, ending in \n\n. */
578 memset(rbuf, 0, sizeof(rbuf));
579 while (!strends(rbuf, "\n\n")) {
580 size_t len = strlen(rbuf);
581 if (cli_read(fd, rbuf + len, sizeof(rbuf) - len) <= 0)
582 err(ERROR_TALKING_TO_LIGHTNINGD,
583 "Reading enable response");
584 }
585}
586
587static char *opt_set_level(const char *arg, enum log_level *level)
588{

Callers 1

mainFunction · 0.85

Calls 3

errFunction · 0.85
strendsFunction · 0.85
write_allFunction · 0.50

Tested by

no test coverage detected