Browse Source

wire/peer_wire: rename gossip_msg / unknown_msg / unknown_msg_discardable

The next patch includes wire/peer_wire.h and causes a compile error
as lightningd/gossip_control.c defined its own gossip_msg function.

New names are clearer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
committed by Christian Decker
parent
commit
d492f3872c
  1. 2
      lightningd/channel/channel.c
  2. 2
      lightningd/cryptomsg.c
  3. 2
      lightningd/opening/opening.c
  4. 2
      lightningd/test/run-cryptomsg.c
  5. 6
      wire/peer_wire.c
  6. 6
      wire/peer_wire.h

2
lightningd/channel/channel.c

@ -1438,7 +1438,7 @@ static struct io_plan *handle_peer_reestablish(struct io_conn *conn,
struct htlc_map_iter it;
const struct htlc *htlc;
if (gossip_msg(msg)) {
if (is_gossip_msg(msg)) {
/* Forward to gossip daemon */
daemon_conn_send(&peer->gossip_client, msg);
return peer_read_message(conn, &peer->pcs,

2
lightningd/cryptomsg.c

@ -139,7 +139,7 @@ static struct io_plan *peer_decrypt_body(struct io_conn *conn,
* A node MUST ignore a received message of unknown type, if that type
* is odd.
*/
if (unlikely(unknown_msg_discardable(decrypted))) {
if (unlikely(is_unknown_msg_discardable(decrypted))) {
pcs->in = tal_free(pcs->in);
return peer_read_message(conn, pcs, pcs->next_in);
}

2
lightningd/opening/opening.c

@ -185,7 +185,7 @@ static u8 *read_next_peer_msg(struct state *state, const tal_t *ctx)
peer_failed(PEER_FD, &state->cs, NULL, WIRE_OPENING_PEER_WRITE_FAILED,
"Sending pong");
tal_free(pong);
} else if (gossip_msg(msg)) {
} else if (is_gossip_msg(msg)) {
/* We relay gossip to gossipd, but don't relay from */
if (!wire_sync_write(GOSSIP_FD, take(msg)))
peer_failed(PEER_FD, &state->cs, NULL,

2
lightningd/test/run-cryptomsg.c

@ -50,7 +50,7 @@ char dev_disconnect(int pkt_type)
}
/* We test what look like unknown messages. */
#define unknown_msg_discardable(x) 0
#define is_unknown_msg_discardable(x) 0
#include "../cryptomsg.c"

6
wire/peer_wire.c

@ -31,7 +31,7 @@ static bool unknown_type(enum wire_type t)
return true;
}
bool gossip_msg(u8 *cursor)
bool is_gossip_msg(const u8 *cursor)
{
switch (fromwire_peektype(cursor)) {
case WIRE_CHANNEL_ANNOUNCEMENT:
@ -62,13 +62,13 @@ bool gossip_msg(u8 *cursor)
}
/* Return true if it's an unknown message. cursor is a tal ptr. */
bool unknown_msg(const u8 *cursor)
bool is_unknown_msg(const u8 *cursor)
{
return unknown_type(fromwire_peektype(cursor));
}
/* Return true if it's an unknown ODD message. cursor is a tal ptr. */
bool unknown_msg_discardable(const u8 *cursor)
bool is_unknown_msg_discardable(const u8 *cursor)
{
enum wire_type t = fromwire_peektype(cursor);
return unknown_type(t) && (t & 1);

6
wire/peer_wire.h

@ -13,11 +13,11 @@
*/
/* Return true if it's an unknown message. cursor is a tal ptr. */
bool unknown_msg(const u8 *cursor);
bool is_unknown_msg(const u8 *cursor);
/* Return true if it's an unknown ODD message. cursor is a tal ptr. */
bool unknown_msg_discardable(const u8 *cursor);
bool is_unknown_msg_discardable(const u8 *cursor);
/* Return true if it's a gossip message. */
bool gossip_msg(u8 *cursor);
bool is_gossip_msg(const u8 *cursor);
/* Compare two short_channel_ids and return true if they are the equal */
bool short_channel_id_eq(const struct short_channel_id *a,

Loading…
Cancel
Save