From 27e0ea23585e9f17fe11e78a33779c073011db87 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 10 Jan 2018 13:13:23 +1030 Subject: [PATCH] wire: remove special zero-key handling. We used to use a hack for gossip_resolve_channel_reply, where we'd send a NULL key on failure. It's now been neatened to use a counter, so we don't need this. Signed-off-by: Rusty Russell --- wire/fromwire.c | 5 +---- wire/towire.c | 9 +++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/wire/fromwire.c b/wire/fromwire.c index 03e5a5cbd..f16222d92 100644 --- a/wire/fromwire.c +++ b/wire/fromwire.c @@ -100,10 +100,7 @@ void fromwire_pubkey(const u8 **cursor, size_t *max, struct pubkey *pubkey) if (!fromwire(cursor, max, der, sizeof(der))) return; - /* FIXME: Handing dummy keys through here is dumb. - * See towire_gossip_resolve_channel_reply --RR */ - if (!memeqzero(der, sizeof(der)) - && !pubkey_from_der(der, sizeof(der), pubkey)) + if (!pubkey_from_der(der, sizeof(der), pubkey)) fromwire_fail(cursor, max); } diff --git a/wire/towire.c b/wire/towire.c index 44927a527..154825a0c 100644 --- a/wire/towire.c +++ b/wire/towire.c @@ -50,12 +50,9 @@ void towire_pubkey(u8 **pptr, const struct pubkey *pubkey) u8 output[PUBKEY_DER_LEN]; size_t outputlen = sizeof(output); - if (pubkey) - secp256k1_ec_pubkey_serialize(secp256k1_ctx, output, &outputlen, - &pubkey->pubkey, - SECP256K1_EC_COMPRESSED); - else - memset(output, 0, sizeof(output)); + secp256k1_ec_pubkey_serialize(secp256k1_ctx, output, &outputlen, + &pubkey->pubkey, + SECP256K1_EC_COMPRESSED); towire(pptr, output, outputlen); }