diff --git a/bitcoin/signature.c b/bitcoin/signature.c index 257ff1589..df64d769c 100644 --- a/bitcoin/signature.c +++ b/bitcoin/signature.c @@ -4,6 +4,7 @@ #include "shadouble.h" #include "signature.h" #include "tx.h" +#include "type_to_string.h" #include "utils.h" #include #include @@ -254,3 +255,13 @@ bool sig_valid(const secp256k1_ecdsa_signature *sig) return true; return false; } + +static char *signature_to_hexstr(const tal_t *ctx, + const secp256k1_ecdsa_signature *sig) +{ + u8 der[72]; + size_t len = signature_to_der(der, sig); + + return tal_hexstr(ctx, der, len); +} +REGISTER_TYPE_TO_STRING(secp256k1_ecdsa_signature, signature_to_hexstr); diff --git a/type_to_string.h b/type_to_string.h index 83b30a735..a774161da 100644 --- a/type_to_string.h +++ b/type_to_string.h @@ -21,6 +21,7 @@ union printable_types { const secp256k1_pubkey *secp256k1_pubkey; const struct channel_id *channel_id; const struct privkey *privkey; + const secp256k1_ecdsa_signature *secp256k1_ecdsa_signature; const char *charp_; };