| 14 | } |
| 15 | |
| 16 | int main(int argc, char *argv[]) |
| 17 | { |
| 18 | u8 encoding, *data; |
| 19 | |
| 20 | setup_locale(); |
| 21 | |
| 22 | if (argv[1] && streq(argv[1], "--scids")) { |
| 23 | argv++; |
| 24 | argc--; |
| 25 | if (argc < 2) |
| 26 | usage(); |
| 27 | data = tal_arr(NULL, u8, 0); |
| 28 | for (size_t i = 2; i < argc; i++) { |
| 29 | struct short_channel_id scid; |
| 30 | if (!short_channel_id_from_str(argv[i], strlen(argv[i]), |
| 31 | &scid)) |
| 32 | errx(1, "Invalid short_channel_id %s", argv[i]); |
| 33 | towire_short_channel_id(&data, scid); |
| 34 | } |
| 35 | } else { |
| 36 | data = tal_hexdata(NULL, argv[2], strlen(argv[2])); |
| 37 | if (!data) |
| 38 | errx(1, "Invalid hex string %s", argv[2]); |
| 39 | } |
| 40 | if (!hex_decode(argv[1], strlen(argv[1]), &encoding, sizeof(encoding))) |
| 41 | errx(1, "Expected single hex byte not %s", argv[1]); |
| 42 | |
| 43 | if (encoding == ARR_UNCOMPRESSED) |
| 44 | printf("%02x%s\n", encoding, tal_hex(NULL, data)); |
| 45 | else if (encoding == ARR_ZLIB_DEPRECATED) { |
| 46 | errx(1, "ZLIB compression deprecated"); |
| 47 | } else { |
| 48 | errx(1, "Unknown encoding %u", encoding); |
| 49 | } |
| 50 | |
| 51 | return 0; |
| 52 | } |
nothing calls this directly
no test coverage detected