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

Function dev_disconnect_permanent

lightningd/subd.c:948–968  ·  view source on GitHub ↗

If test specified that this disconnection should cause permanent failure */

Source from the content-addressed store, hash-verified

946
947/* If test specified that this disconnection should cause permanent failure */
948bool dev_disconnect_permanent(struct lightningd *ld)
949{
950 char permfail[sizeof("PERMFAIL") - 1];
951 int r;
952
953 if (ld->dev_disconnect_fd == -1)
954 return false;
955
956 r = read(ld->dev_disconnect_fd, permfail, sizeof(permfail));
957 if (r < 0)
958 fatal("Reading dev_disconnect file: %s", strerror(errno));
959
960 if (memeq(permfail, r, "permfail", strlen("permfail")))
961 return true;
962
963 /* Nope, restore. */
964 if (lseek(ld->dev_disconnect_fd, -r, SEEK_CUR) < 0) {
965 fatal("lseek failure");
966 }
967 return false;
968}
969
970/* Ugly helper to get full pathname of the current binary. */
971const char *find_my_abspath(const tal_t *ctx, const char *argv0)

Callers 2

channel_errFunction · 0.70

Calls 2

memeqFunction · 0.85
fatalFunction · 0.70

Tested by

no test coverage detected