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

Function openingd_msg

lightningd/opening_control.c:850–907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

848}
849
850static unsigned int openingd_msg(struct subd *openingd,
851 const u8 *msg, const int *fds)
852{
853 enum openingd_wire t = fromwire_peektype(msg);
854 struct uncommitted_channel *uc = openingd->channel;
855
856 switch (t) {
857 case WIRE_OPENINGD_FUNDER_REPLY:
858 if (!uc->fc) {
859 log_broken(openingd->log, "Unexpected FUNDER_REPLY %s",
860 tal_hex(tmpctx, msg));
861 tal_free(openingd);
862 return 0;
863 }
864 if (tal_count(fds) != 1)
865 return 1;
866 opening_funder_finished(openingd, msg, fds, uc->fc);
867 return 0;
868 case WIRE_OPENINGD_FUNDER_START_REPLY:
869 if (!uc->fc) {
870 log_broken(openingd->log, "Unexpected FUNDER_START_REPLY %s",
871 tal_hex(tmpctx, msg));
872 tal_free(openingd);
873 return 0;
874 }
875 opening_funder_start_replied(openingd, msg, fds, uc->fc);
876 return 0;
877 case WIRE_OPENINGD_FAILED:
878 openingd_failed(openingd, msg, uc);
879 return 0;
880
881 case WIRE_OPENINGD_FUNDEE:
882 if (tal_count(fds) != 1)
883 return 1;
884 opening_fundee_finished(openingd, msg, fds, uc);
885 return 0;
886
887 case WIRE_OPENINGD_GOT_OFFER:
888 opening_got_offer(openingd, msg, uc);
889 return 0;
890
891 /* We send these! */
892 case WIRE_OPENINGD_INIT:
893 case WIRE_OPENINGD_FUNDER_START:
894 case WIRE_OPENINGD_FUNDER_COMPLETE:
895 case WIRE_OPENINGD_FUNDER_CANCEL:
896 case WIRE_OPENINGD_GOT_OFFER_REPLY:
897 case WIRE_OPENINGD_DEV_MEMLEAK:
898 /* Replies never get here */
899 case WIRE_OPENINGD_DEV_MEMLEAK_REPLY:
900 break;
901 }
902
903 log_broken(openingd->log, "Unexpected msg %s: %s",
904 openingd_wire_name(t), tal_hex(tmpctx, msg));
905 tal_free(openingd);
906 return 0;
907}

Callers

nothing calls this directly

Calls 8

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
fromwire_peektypeFunction · 0.50

Tested by

no test coverage detected