onion_key: allowing both odd and even pubkeys

output compressed public keys; accept compressed pubkey in test_onion
This commit is contained in:
Anthony Towns
2015-10-06 23:49:52 +10:00
parent 2042e1cdb7
commit 9ffac49c6f
3 changed files with 14 additions and 5 deletions

View File

@@ -588,9 +588,9 @@ bool peel_onion(struct onion *onion,
static bool parse_onion_pubkey(secp256k1_context *ctx,
const char *arg, secp256k1_pubkey *pubkey)
{
unsigned char tmp[33] = { 0x2 };
unsigned char tmp[33] = { };
if (!hex_decode(arg, strlen(arg), tmp + 1, sizeof(tmp) - 1))
if (!hex_decode(arg, strlen(arg), tmp, sizeof(tmp)))
return false;
return secp256k1_ec_pubkey_parse(ctx, pubkey, tmp, sizeof(tmp));