Skip to content

Commit 600d4d0

Browse files
cdeckerjb55
authored andcommitted
routing: Make the announcement state of a channel explicit
Using the implicit signal of having channel_announcement set doesn't always work. Signed-off-by: Christian Decker <[email protected]>
1 parent 2552790 commit 600d4d0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

gossipd/routing.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ get_or_make_connection(struct routing_state *rstate,
193193
nc->dst = to;
194194
nc->channel_announcement = NULL;
195195
nc->channel_update = NULL;
196+
nc->announced = false;
196197

197198
/* Hook it into in/out arrays. */
198199
i = tal_count(to->in);
@@ -540,7 +541,7 @@ bool handle_channel_announcement(
540541
/* Is this a new connection? */
541542
c0 = get_connection_by_scid(rstate, &short_channel_id, 0);
542543
c1 = get_connection_by_scid(rstate, &short_channel_id, 1);
543-
forward = !c0 || !c1 || !c0->channel_announcement || !c1->channel_announcement;
544+
forward = !c0 || !c1 || !c0->announced || !c1->announced;
544545

545546
add_channel_direction(rstate, &node_id_1, &node_id_2, &short_channel_id,
546547
sigfail ? NULL : serialized);
@@ -561,6 +562,9 @@ bool handle_channel_announcement(
561562
tag, serialized);
562563

563564
tal_free(tmpctx);
565+
c0 = get_connection_by_scid(rstate, &short_channel_id, 0);
566+
c1 = get_connection_by_scid(rstate, &short_channel_id, 1);
567+
c0->announced = c1->announced = true;
564568
return local;
565569
}
566570

gossipd/routing.h

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ struct node_connection {
2222
/* Is this connection active? */
2323
bool active;
2424

25+
/* Was this channel already announced through a channel_announcement? */
26+
bool announced;
27+
2528
s64 last_timestamp;
2629

2730
/* Minimum number of msatoshi in an HTLC */

0 commit comments

Comments
 (0)