Browse Source

gossipd: naming cleanups.

Suggested-by: @cdecker.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
parent
commit
6a8d18c7e3
  1. 2
      gossipd/Makefile
  2. 5
      gossipd/gossip_generation.c
  3. 6
      gossipd/gossip_generation.h
  4. 6
      gossipd/gossipd.c
  5. 9
      gossipd/routing.c
  6. 2
      gossipd/test/run-crc32_of_update.c

2
gossipd/Makefile

@ -17,7 +17,7 @@ LIGHTNINGD_GOSSIP_HEADERS_WSRC := gossipd/gen_gossip_wire.h \
gossipd/gen_gossip_store.h \
gossipd/gossipd.h \
gossipd/gossip_store.h \
gossipd/make_gossip.h \
gossipd/gossip_generation.h \
gossipd/routing.h
LIGHTNINGD_GOSSIP_HEADERS := $(LIGHTNINGD_GOSSIP_HEADERS_WSRC) gossipd/broadcast.h
LIGHTNINGD_GOSSIP_SRC := $(LIGHTNINGD_GOSSIP_HEADERS_WSRC:.h=.c)

5
gossipd/make_gossip.c → gossipd/gossip_generation.c

@ -1,4 +1,5 @@
/* Routines to make our own gossip messages */
/* Routines to make our own gossip messages. Not as in "we're the gossip
* generation, man!" */
#include <ccan/mem/mem.h>
#include <common/memleak.h>
#include <common/timeout.h>
@ -6,9 +7,9 @@
#include <common/wireaddr.h>
#include <errno.h>
#include <gossipd/gen_gossip_peerd_wire.h>
#include <gossipd/gossip_generation.h>
#include <gossipd/gossip_store.h>
#include <gossipd/gossipd.h>
#include <gossipd/make_gossip.h>
#include <hsmd/gen_hsm_wire.h>
#include <wire/gen_peer_wire.h>
#include <wire/wire_sync.h>

6
gossipd/make_gossip.h → gossipd/gossip_generation.h

@ -1,5 +1,5 @@
#ifndef LIGHTNING_GOSSIPD_MAKE_GOSSIP_H
#define LIGHTNING_GOSSIPD_MAKE_GOSSIP_H
#ifndef LIGHTNING_GOSSIPD_GOSSIP_GENERATION_H
#define LIGHTNING_GOSSIPD_GOSSIP_GENERATION_H
#include "config.h"
#include <ccan/short_types/short_types.h>
#include <stdbool.h>
@ -44,4 +44,4 @@ bool handle_local_channel_update(struct daemon *daemon,
const struct node_id *src,
const u8 *msg);
#endif /* LIGHTNING_GOSSIPD_MAKE_GOSSIP_H */
#endif /* LIGHTNING_GOSSIPD_GOSSIP_GENERATION_H */

6
gossipd/gossipd.c

@ -52,8 +52,8 @@
#include <gossipd/broadcast.h>
#include <gossipd/gen_gossip_peerd_wire.h>
#include <gossipd/gen_gossip_wire.h>
#include <gossipd/gossip_generation.h>
#include <gossipd/gossipd.h>
#include <gossipd/make_gossip.h>
#include <gossipd/routing.h>
#include <inttypes.h>
#include <lightningd/gossip_msg.h>
@ -1454,7 +1454,7 @@ static void dump_gossip(struct peer *peer)
* sets the UPDATE bit in the error type. lightningd is too important to
* fetch this itself, so channeld does it (channeld has to talk to us for
* other things anyway, so why not?). */
static bool handle_get_update(struct peer *peer, const u8 *msg)
static bool handle_get_local_channel_update(struct peer *peer, const u8 *msg)
{
struct short_channel_id scid;
struct local_chan *local_chan;
@ -1572,7 +1572,7 @@ static struct io_plan *peer_msg_in(struct io_conn *conn,
/* Must be a gossip_peerd_wire_type asking us to do something. */
switch ((enum gossip_peerd_wire_type)fromwire_peektype(msg)) {
case WIRE_GOSSIPD_GET_UPDATE:
ok = handle_get_update(peer, msg);
ok = handle_get_local_channel_update(peer, msg);
goto handled_cmd;
case WIRE_GOSSIPD_LOCAL_ADD_CHANNEL:
ok = handle_local_add_channel(peer->daemon->rstate, msg, 0);

9
gossipd/routing.c

@ -16,7 +16,7 @@
#include <gossipd/gen_gossip_peerd_wire.h>
#include <gossipd/gen_gossip_store.h>
#include <gossipd/gen_gossip_wire.h>
#include <gossipd/make_gossip.h>
#include <gossipd/gossip_generation.h>
#include <inttypes.h>
#include <wire/gen_peer_wire.h>
@ -485,7 +485,7 @@ static void destroy_local_chan(struct local_chan *local_chan,
abort();
}
static struct local_chan *new_local_chan(struct routing_state *rstate,
static void maybe_add_local_chan(struct routing_state *rstate,
struct chan *chan)
{
int direction;
@ -496,7 +496,7 @@ static struct local_chan *new_local_chan(struct routing_state *rstate,
else if (node_id_eq(&chan->nodes[1]->id, &rstate->local_id))
direction = 1;
else
return NULL;
return;
local_chan = tal(chan, struct local_chan);
local_chan->chan = chan;
@ -506,7 +506,6 @@ static struct local_chan *new_local_chan(struct routing_state *rstate,
local_chan_map_add(&rstate->local_chan_map, local_chan);
tal_add_destructor2(local_chan, destroy_local_chan, rstate);
return local_chan;
}
struct chan *new_chan(struct routing_state *rstate,
@ -551,7 +550,7 @@ struct chan *new_chan(struct routing_state *rstate,
uintmap_add(&rstate->chanmap, scid->u64, chan);
/* Initialize shadow structure if it's local */
new_local_chan(rstate, chan);
maybe_add_local_chan(rstate, chan);
return chan;
}

2
gossipd/test/run-crc32_of_update.c

@ -1,7 +1,7 @@
int unused_main(int argc, char *argv[]);
#define main unused_main
#include "../gossipd.c"
#include "../make_gossip.c"
#include "../gossip_generation.c"
#undef main
#include <stdio.h>

Loading…
Cancel
Save