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