| 908 | } |
| 909 | |
| 910 | static unsigned int openingd_msg(struct subd *openingd, |
| 911 | const u8 *msg, const int *fds) |
| 912 | { |
| 913 | enum openingd_wire t = fromwire_peektype(msg); |
| 914 | struct uncommitted_channel *uc = openingd->channel; |
| 915 | |
| 916 | switch (t) { |
| 917 | case WIRE_OPENINGD_FUNDER_REPLY: |
| 918 | if (!uc->fc) { |
| 919 | log_broken(openingd->log, "Unexpected FUNDER_REPLY %s", |
| 920 | tal_hex(tmpctx, msg)); |
| 921 | tal_free(openingd); |
| 922 | return 0; |
| 923 | } |
| 924 | if (tal_count(fds) != 1) |
| 925 | return 1; |
| 926 | opening_funder_finished(openingd, msg, fds, uc->fc); |
| 927 | return 0; |
| 928 | case WIRE_OPENINGD_FUNDER_START_REPLY: |
| 929 | if (!uc->fc) { |
| 930 | log_broken(openingd->log, "Unexpected FUNDER_START_REPLY %s", |
| 931 | tal_hex(tmpctx, msg)); |
| 932 | tal_free(openingd); |
| 933 | return 0; |
| 934 | } |
| 935 | opening_funder_start_replied(openingd, msg, fds, uc->fc); |
| 936 | return 0; |
| 937 | case WIRE_OPENINGD_FAILED: |
| 938 | openingd_failed(openingd, msg, uc); |
| 939 | return 0; |
| 940 | |
| 941 | case WIRE_OPENINGD_FUNDEE: |
| 942 | if (tal_count(fds) != 1) |
| 943 | return 1; |
| 944 | opening_fundee_finished(openingd, msg, fds, uc); |
| 945 | return 0; |
| 946 | |
| 947 | case WIRE_OPENINGD_GOT_OFFER: |
| 948 | opening_got_offer(openingd, msg, uc); |
| 949 | return 0; |
| 950 | |
| 951 | /* We send these! */ |
| 952 | case WIRE_OPENINGD_INIT: |
| 953 | case WIRE_OPENINGD_FUNDER_START: |
| 954 | case WIRE_OPENINGD_FUNDER_COMPLETE: |
| 955 | case WIRE_OPENINGD_FUNDER_CANCEL: |
| 956 | case WIRE_OPENINGD_GOT_OFFER_REPLY: |
| 957 | case WIRE_OPENINGD_DEV_MEMLEAK: |
| 958 | /* Replies never get here */ |
| 959 | case WIRE_OPENINGD_DEV_MEMLEAK_REPLY: |
| 960 | break; |
| 961 | } |
| 962 | |
| 963 | log_broken(openingd->log, "Unexpected msg %s: %s", |
| 964 | openingd_wire_name(t), tal_hex(tmpctx, msg)); |
| 965 | tal_free(openingd); |
| 966 | return 0; |
| 967 | } |
nothing calls this directly
no test coverage detected