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

Function fromwire_wireaddr_array

common/wireaddr.c:858–891  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856}
857
858struct 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
893bool all_tor_addresses(const struct wireaddr_internal *wireaddr)
894{

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