| 10 | #include <wally_core.h> |
| 11 | |
| 12 | static char *to_base58(const tal_t *ctx, u8 version, |
| 13 | const struct ripemd160 *rmd) |
| 14 | { |
| 15 | char *out; |
| 16 | size_t total_length = sizeof(*rmd) + 1; |
| 17 | u8 buf[total_length]; |
| 18 | buf[0] = version; |
| 19 | memcpy(buf + 1, rmd, sizeof(*rmd)); |
| 20 | |
| 21 | tal_wally_start(); |
| 22 | if (wally_base58_from_bytes((const unsigned char *) buf, |
| 23 | total_length, BASE58_FLAG_CHECKSUM, &out) |
| 24 | != WALLY_OK) |
| 25 | out = NULL; |
| 26 | tal_wally_end_onto(ctx, out, char); |
| 27 | |
| 28 | return out; |
| 29 | } |
| 30 | |
| 31 | char *bitcoin_to_base58(const tal_t *ctx, const struct chainparams *chainparams, |
| 32 | const struct bitcoin_address *addr) |
no test coverage detected