Browse Source

channel: Die on unexpected gossipd messages

ppa-0.6.1
Christian Decker 8 years ago
committed by Rusty Russell
parent
commit
605438f213
  1. 4
      lightningd/channel/channel.c
  2. 1
      lightningd/channel/channel_wire.csv
  3. 1
      lightningd/peer_control.c

4
lightningd/channel/channel.c

@ -118,6 +118,9 @@ static struct io_plan *gossip_client_recv(struct io_conn *conn,
if (type == WIRE_CHANNEL_ANNOUNCEMENT || type == WIRE_CHANNEL_UPDATE ||
type == WIRE_NODE_ANNOUNCEMENT)
msg_enqueue(&peer->peer_out, msg);
else
status_failed(WIRE_CHANNEL_GOSSIP_BAD_MESSAGE,
"Got bad message from gossipd: %d", type);
return daemon_conn_read_next(conn, dc);
}
@ -1327,6 +1330,7 @@ static struct io_plan *req_in(struct io_conn *conn, struct daemon_conn *master)
case WIRE_CHANNEL_BAD_COMMAND:
case WIRE_CHANNEL_HSM_FAILED:
case WIRE_CHANNEL_CRYPTO_FAILED:
case WIRE_CHANNEL_GOSSIP_BAD_MESSAGE:
case WIRE_CHANNEL_INTERNAL_ERROR:
case WIRE_CHANNEL_PEER_WRITE_FAILED:
case WIRE_CHANNEL_PEER_READ_FAILED:

1
lightningd/channel/channel_wire.csv

@ -4,6 +4,7 @@ channel_bad_command,0x8000
channel_hsm_failed,0x8001
channel_crypto_failed,0x8002
channel_internal_error,0x8003
channel_gossip_bad_message,0x8004
# These are due to peer.
channel_peer_write_failed,0x8010

Can't render this file because it has a wrong number of fields in line 2.

1
lightningd/peer_control.c

@ -1476,6 +1476,7 @@ static int channel_msg(struct subd *sd, const u8 *msg, const int *unused)
case WIRE_CHANNEL_BAD_COMMAND:
case WIRE_CHANNEL_HSM_FAILED:
case WIRE_CHANNEL_CRYPTO_FAILED:
case WIRE_CHANNEL_GOSSIP_BAD_MESSAGE:
case WIRE_CHANNEL_INTERNAL_ERROR:
case WIRE_CHANNEL_PEER_WRITE_FAILED:
case WIRE_CHANNEL_PEER_READ_FAILED:

Loading…
Cancel
Save