mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-30 11:14:20 +01:00
type_to_string: add secp256k1_pubkey
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -62,6 +62,18 @@ char *pubkey_to_hexstr(const tal_t *ctx, const struct pubkey *key)
|
||||
return tal_hexstr(ctx, der, sizeof(der));
|
||||
}
|
||||
|
||||
char *secp256k1_pubkey_to_hexstr(const tal_t *ctx, const secp256k1_pubkey *key)
|
||||
{
|
||||
unsigned char der[PUBKEY_DER_LEN];
|
||||
size_t outlen = sizeof(der);
|
||||
if (!secp256k1_ec_pubkey_serialize(secp256k1_ctx, der, &outlen, key,
|
||||
SECP256K1_EC_COMPRESSED))
|
||||
abort();
|
||||
assert(outlen == sizeof(der));
|
||||
return tal_hexstr(ctx, der, sizeof(der));
|
||||
}
|
||||
REGISTER_TYPE_TO_STRING(secp256k1_pubkey, secp256k1_pubkey_to_hexstr);
|
||||
|
||||
bool pubkey_eq(const struct pubkey *a, const struct pubkey *b)
|
||||
{
|
||||
return structeq(&a->pubkey, &b->pubkey);
|
||||
|
||||
Reference in New Issue
Block a user