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

Function fromwire_wireaddr_array

common/wireaddr.c:880–913  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

878}
879
880struct 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
915bool all_tor_addresses(const struct wireaddr_internal *wireaddr)
916{

Callers 4

append_gossmap_addressesFunction · 0.85
json_add_nodeFunction · 0.85
we_want_blinded_pathFunction · 0.85

Calls 3

fromwire_wireaddrFunction · 0.85
tal_freeFunction · 0.85
abortFunction · 0.85

Tested by

no test coverage detected