channeld: ignore spurious open_channel packets.

Currently we peer_failed() which fails the existing channel too!

Fixes: #494
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-01-10 15:18:07 +10:30 committed by Christian Decker
parent 2bc2502b23
commit 71f13ab6b0

View File

@ -1534,6 +1534,21 @@ static void peer_in(struct peer *peer, const u8 *msg)
enum wire_type type = fromwire_peektype(msg);
status_trace("peer_in %s", wire_type_name(type));
/* FIXME: We don't support concurrent channels with same peer. */
if (type == WIRE_OPEN_CHANNEL) {
struct channel_id channel_id;
if (extract_channel_id(msg, &channel_id)) {
u8 *reply;
reply = towire_errorfmt(msg, &channel_id,
"Opening multiple channels"
" unsupported");
enqueue_peer_msg(peer, take(reply));
return;
}
}
/* Must get funding_locked before almost anything. */
if (!peer->funding_locked[REMOTE]) {
/* We can get gossip before funding, too */