| 705 | } |
| 706 | |
| 707 | static bool bech32_decode_alloc(const tal_t *ctx, |
| 708 | const char **hrp_ret, |
| 709 | const u5 **data_ret, |
| 710 | size_t *data_len, |
| 711 | const char *str) |
| 712 | { |
| 713 | char *hrp = tal_arr(ctx, char, strlen(str) - 6); |
| 714 | u5 *data = tal_arr(ctx, u5, strlen(str) - 8); |
| 715 | |
| 716 | if (bech32_decode(hrp, data, data_len, str, (size_t)-1) |
| 717 | != BECH32_ENCODING_BECH32) { |
| 718 | tal_free(hrp); |
| 719 | tal_free(data); |
| 720 | return false; |
| 721 | } |
| 722 | |
| 723 | /* We needed temporaries because these are const */ |
| 724 | *hrp_ret = hrp; |
| 725 | *data_ret = data; |
| 726 | return true; |
| 727 | } |
| 728 | |
| 729 | static bool has_lightning_prefix(const char *invstring) |
| 730 | { |
no test coverage detected