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