| 878 | } |
| 879 | |
| 880 | struct wireaddr *fromwire_wireaddr_array(const tal_t *ctx, const u8 *ser) |
| 881 | { |
| 882 | const u8 *cursor = ser; |
| 883 | size_t len = tal_count(ser); |
| 884 | struct wireaddr *wireaddrs = tal_arr(ctx, struct wireaddr, 0); |
| 885 | |
| 886 | while (cursor && len) { |
| 887 | struct wireaddr wireaddr; |
| 888 | |
| 889 | /* BOLT #7: |
| 890 | * |
| 891 | * The receiving node: |
| 892 | *... |
| 893 | * - SHOULD ignore the first `address descriptor` that does |
| 894 | * NOT match the types defined above. |
| 895 | */ |
| 896 | switch (fromwire_wireaddr(&cursor, &len, &wireaddr)) { |
| 897 | case FROMWIREADDR_MALFORMED: |
| 898 | /* Parsing address failed */ |
| 899 | return tal_free(wireaddrs); |
| 900 | case FROMWIREADDR_UNKNOWN: |
| 901 | /* Unknown type, stop there. */ |
| 902 | len = 0; |
| 903 | continue; |
| 904 | case FROMWIREADDR_IGNORE: |
| 905 | continue; |
| 906 | case FROMWIREADDR_OK: |
| 907 | tal_arr_expand(&wireaddrs, wireaddr); |
| 908 | continue; |
| 909 | } |
| 910 | abort(); |
| 911 | } |
| 912 | return wireaddrs; |
| 913 | } |
| 914 | |
| 915 | bool all_tor_addresses(const struct wireaddr_internal *wireaddr) |
| 916 | { |
no test coverage detected