lightningd/gossip: clean up channel resolve failure handling.

We were getting an assert "!secp256k1_fe_is_zero(&ge->x)", because
an all-zero pubkey is invalid.  We allow marshal/unmarshal of NULL for
now, and clean up the error handling.

1. Use status_failed if master sends a bad message.
2. Similarly, kill the gossip daemon if it gives a bad reply.
3. Use an array for returned pubkeys: 0 or 2.
4. Use type_to_string(trc, struct short_channel_id, &scid) for tracing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-05-05 16:11:44 +09:30
parent 2641ecaafa
commit cd90c8408c
5 changed files with 54 additions and 33 deletions

View File

@@ -99,7 +99,10 @@ void fromwire_pubkey(const u8 **cursor, size_t *max, struct pubkey *pubkey)
if (!fromwire(cursor, max, der, sizeof(der)))
return;
if (!pubkey_from_der(der, sizeof(der), pubkey))
/* 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))
fail_pull(cursor, max);
}