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

Function enable_notifications

cli/lightning-cli.c:555–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.85

Calls 3

errFunction · 0.85
strendsFunction · 0.85
write_allFunction · 0.50

Tested by

no test coverage detected