type_to_string: add secp256k1_ecdsa_signature.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-02-02 14:35:45 +10:30
parent 25a37fafae
commit 7d68554787
2 changed files with 12 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include "shadouble.h"
#include "signature.h"
#include "tx.h"
#include "type_to_string.h"
#include "utils.h"
#include <assert.h>
#include <ccan/cast/cast.h>
@ -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);

View File

@ -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_;
};