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

Function openingd_msg

lightningd/opening_control.c:897–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

895}
896
897static unsigned int openingd_msg(struct subd *openingd,
898 const u8 *msg, const int *fds)
899{
900 enum openingd_wire t = fromwire_peektype(msg);
901 struct uncommitted_channel *uc = openingd->channel;
902
903 switch (t) {
904 case WIRE_OPENINGD_FUNDER_REPLY:
905 if (!uc->fc) {
906 log_broken(openingd->log, "Unexpected FUNDER_REPLY %s",
907 tal_hex(tmpctx, msg));
908 tal_free(openingd);
909 return 0;
910 }
911 if (tal_count(fds) != 1)
912 return 1;
913 opening_funder_finished(openingd, msg, fds, uc->fc);
914 return 0;
915 case WIRE_OPENINGD_FUNDER_START_REPLY:
916 if (!uc->fc) {
917 log_broken(openingd->log, "Unexpected FUNDER_START_REPLY %s",
918 tal_hex(tmpctx, msg));
919 tal_free(openingd);
920 return 0;
921 }
922 opening_funder_start_replied(openingd, msg, fds, uc->fc);
923 return 0;
924 case WIRE_OPENINGD_FAILED:
925 openingd_failed(openingd, msg, uc);
926 return 0;
927
928 case WIRE_OPENINGD_FUNDEE:
929 if (tal_count(fds) != 1)
930 return 1;
931 opening_fundee_finished(openingd, msg, fds, uc);
932 return 0;
933
934 case WIRE_OPENINGD_GOT_OFFER:
935 opening_got_offer(openingd, msg, uc);
936 return 0;
937
938 /* We send these! */
939 case WIRE_OPENINGD_INIT:
940 case WIRE_OPENINGD_FUNDER_START:
941 case WIRE_OPENINGD_FUNDER_COMPLETE:
942 case WIRE_OPENINGD_FUNDER_CANCEL:
943 case WIRE_OPENINGD_GOT_OFFER_REPLY:
944 case WIRE_OPENINGD_DEV_MEMLEAK:
945 /* Replies never get here */
946 case WIRE_OPENINGD_DEV_MEMLEAK_REPLY:
947 break;
948 }
949
950 log_broken(openingd->log, "Unexpected msg %s: %s",
951 openingd_wire_name(t), tal_hex(tmpctx, msg));
952 tal_free(openingd);
953 return 0;
954}

Callers

nothing calls this directly

Calls 8

fromwire_peektypeFunction · 0.85
tal_hexFunction · 0.85
tal_freeFunction · 0.85
opening_funder_finishedFunction · 0.85
openingd_failedFunction · 0.85
opening_fundee_finishedFunction · 0.85
opening_got_offerFunction · 0.85

Tested by

no test coverage detected