pubkey/scid/feebase/feeprop/expiry,... */
| 43 | |
| 44 | /* pubkey/scid/feebase/feeprop/expiry,... */ |
| 45 | static void add_route(struct bolt11 *b11, const char *routestr) |
| 46 | { |
| 47 | struct route_info *rarr; |
| 48 | char **rparts = tal_strsplit(tmpctx, routestr, ",", STR_EMPTY_OK); |
| 49 | |
| 50 | rarr = tal_arr(b11->routes, struct route_info, tal_count(rparts)-1); |
| 51 | for (size_t i = 0; rparts[i]; i++) { |
| 52 | char **parts = tal_strsplit(tmpctx, rparts[i], "/", STR_EMPTY_OK); |
| 53 | if (tal_count(parts) != 6) |
| 54 | errx(ERROR_USAGE, |
| 55 | "Bad route %s (expected 5 fields with / separators)", |
| 56 | rparts[i]); |
| 57 | if (!node_id_from_hexstr(parts[0], strlen(parts[0]), |
| 58 | &rarr[i].pubkey)) |
| 59 | errx(ERROR_USAGE, "Bad route publey %s", parts[0]); |
| 60 | if (!short_channel_id_from_str(parts[1], strlen(parts[1]), |
| 61 | &rarr[i].short_channel_id)) |
| 62 | errx(ERROR_USAGE, "Bad route scid %s", parts[1]); |
| 63 | rarr[i].fee_base_msat = atol(parts[2]); |
| 64 | rarr[i].fee_proportional_millionths = atol(parts[3]); |
| 65 | rarr[i].cltv_expiry_delta = atol(parts[4]); |
| 66 | } |
| 67 | tal_arr_expand(&b11->routes, rarr); |
| 68 | } |
| 69 | |
| 70 | static char *fmt_time(const tal_t *ctx, u64 time) |
| 71 | { |
no test coverage detected