| 856 | } |
| 857 | |
| 858 | struct wireaddr *fromwire_wireaddr_array(const tal_t *ctx, const u8 *ser) |
| 859 | { |
| 860 | const u8 *cursor = ser; |
| 861 | size_t len = tal_count(ser); |
| 862 | struct wireaddr *wireaddrs = tal_arr(ctx, struct wireaddr, 0); |
| 863 | |
| 864 | while (cursor && len) { |
| 865 | struct wireaddr wireaddr; |
| 866 | |
| 867 | /* BOLT #7: |
| 868 | * |
| 869 | * The receiving node: |
| 870 | *... |
| 871 | * - SHOULD ignore the first `address descriptor` that does |
| 872 | * NOT match the types defined above. |
| 873 | */ |
| 874 | switch (fromwire_wireaddr(&cursor, &len, &wireaddr)) { |
| 875 | case FROMWIREADDR_MALFORMED: |
| 876 | /* Parsing address failed */ |
| 877 | return tal_free(wireaddrs); |
| 878 | case FROMWIREADDR_UNKNOWN: |
| 879 | /* Unknown type, stop there. */ |
| 880 | len = 0; |
| 881 | continue; |
| 882 | case FROMWIREADDR_IGNORE: |
| 883 | continue; |
| 884 | case FROMWIREADDR_OK: |
| 885 | tal_arr_expand(&wireaddrs, wireaddr); |
| 886 | continue; |
| 887 | } |
| 888 | abort(); |
| 889 | } |
| 890 | return wireaddrs; |
| 891 | } |
| 892 | |
| 893 | bool all_tor_addresses(const struct wireaddr_internal *wireaddr) |
| 894 | { |
no test coverage detected