node_connection: move channel_announcement field into struct routing_channel.

We don't actually *use it*, mind you: the copy in the broadcast message
is the one we use.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-03-02 19:29:17 +10:30 committed by Christian Decker
parent 942d04ba87
commit b7ec2c8c9c
2 changed files with 7 additions and 12 deletions

View File

@ -238,7 +238,6 @@ static struct node_connection *new_node_connection(struct routing_state *rstate,
c->src = from;
c->dst = to;
c->short_channel_id = chan->scid;
c->channel_announcement = NULL;
c->channel_update = NULL;
c->unroutable_until = 0;
c->active = false;
@ -274,6 +273,7 @@ struct routing_channel *new_routing_channel(struct routing_state *rstate,
chan->nodes[n1idx] = n1;
chan->nodes[!n1idx] = n2;
chan->txout_script = NULL;
chan->channel_announcement = NULL;
chan->public = false;
memset(&chan->msg_indexes, 0, sizeof(chan->msg_indexes));
@ -776,14 +776,8 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
chan->public = true;
/* Save channel_announcement. */
tal_free(chan->connections[0]->channel_announcement);
chan->connections[0]->channel_announcement
= tal_dup_arr(chan->connections[0], u8, pending->announce,
tal_len(pending->announce), 0);
tal_free(chan->connections[1]->channel_announcement);
chan->connections[1]->channel_announcement
= tal_dup_arr(chan->connections[1], u8, pending->announce,
tal_len(pending->announce), 0);
tal_free(chan->channel_announcement);
chan->channel_announcement = tal_steal(chan, pending->announce);
if (replace_broadcast(rstate->broadcasts,
&chan->msg_indexes[MSG_INDEX_CANNOUNCE],

View File

@ -39,9 +39,7 @@ struct node_connection {
* things indicated direction wrt the `channel_id` */
u16 flags;
/* Cached `channel_announcement` and `channel_update` we might forward to new peers*/
/* FIXME: Remove */
u8 *channel_announcement;
/* Cached `channel_update` we might forward to new peers*/
u8 *channel_update;
/* If greater than current time, this connection should not
@ -104,6 +102,9 @@ struct routing_channel {
/* nodes[0].id < nodes[1].id */
struct node *nodes[2];
/* Cached `channel_announcement` we might forward to new peers*/
const u8 *channel_announcement;
/* FIXME: Move msg_index[MSG_INDEX_CUPDATE*] into connections[] */
u64 msg_indexes[3];