diff --git a/daemon/packets.c b/daemon/packets.c index cee0f518a..046595e22 100644 --- a/daemon/packets.c +++ b/daemon/packets.c @@ -241,6 +241,12 @@ Pkt *pkt_init(struct peer *peer, u64 ack) Init *i = tal(peer, Init); init__init(i); i->ack = ack; + /* BOLT #2: + * + * A node SHOULD set the `features` field of the `init` + * message to a bitset representing features it supports. + */ + /* No features yet! */ return make_pkt(peer, PKT__PKT_INIT, i); } diff --git a/daemon/peer.c b/daemon/peer.c index d2530c8a0..fbc6a7af9 100644 --- a/daemon/peer.c +++ b/daemon/peer.c @@ -2108,6 +2108,11 @@ static struct io_plan *init_pkt_in(struct io_conn *conn, struct peer *peer) if (peer->inpkt->init->has_features) { size_t i; + /* BOLT #2: + * + * The receiving node SHOULD ignore any odd feature bits it + * does not support, and MUST fail the connection if any + * unsupported even `features` bit is set. */ for (i = 0; i < peer->inpkt->init->features.len*CHAR_BIT; i++) { size_t byte = i / CHAR_BIT, bit = i % CHAR_BIT; if (peer->inpkt->init->features.data[byte] & (1<