MCPcopy Create free account
hub / github.com/ElementsProject/lightning / privkey_to_hexstr

Function privkey_to_hexstr

bitcoin/privkey.c:7–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <wire/wire.h>
6
7static char *privkey_to_hexstr(const tal_t *ctx, const struct privkey *secret)
8{
9 /* Bitcoin appends "01" to indicate the pubkey is compressed. */
10 char *str = tal_arr(ctx, char, hex_str_size(sizeof(*secret) + 1));
11 hex_encode(secret, sizeof(*secret), str, hex_str_size(sizeof(*secret)));
12 strcat(str, "01");
13 return str;
14}
15REGISTER_TYPE_TO_STRING(privkey, privkey_to_hexstr);
16REGISTER_TYPE_TO_HEXSTR(secret);
17

Callers

nothing calls this directly

Calls 2

hex_str_sizeFunction · 0.85
hex_encodeFunction · 0.85

Tested by

no test coverage detected