gossipd: keep a flag to indicate that we have features in channel_announcement.

This saves us keeping it in memory (so far, no channels have features), but
lets us optimize that case so we don't need to hit the disk for most of the
channels in listchannels.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2020-05-04 09:48:34 +09:30
parent 855debcfe1
commit 7cac5be5cb
6 changed files with 21 additions and 9 deletions

View File

@@ -149,7 +149,7 @@ static void add_connection(struct routing_state *rstate,
chan = get_channel(rstate, &scid);
if (!chan) {
chan = new_chan(rstate, &scid, &nodes[from], &nodes[to],
AMOUNT_SAT(1000000));
AMOUNT_SAT(1000000), NULL);
}
c = &chan->half[idx];

View File

@@ -134,7 +134,7 @@ get_or_make_connection(struct routing_state *rstate,
abort();
chan = get_channel(rstate, &scid);
if (!chan)
chan = new_chan(rstate, &scid, from_id, to_id, satoshis);
chan = new_chan(rstate, &scid, from_id, to_id, satoshis, NULL);
/* Make sure it's seen as initialized (index non-zero). */
chan->half[idx].bcast.index = 1;

View File

@@ -142,7 +142,7 @@ static void add_connection(struct routing_state *rstate,
chan = get_channel(rstate, &scid);
if (!chan)
chan = new_chan(rstate, &scid, from, to, satoshis);
chan = new_chan(rstate, &scid, from, to, satoshis, NULL);
c = &chan->half[node_id_idx(from, to)];
/* Make sure it's seen as initialized (index non-zero). */

View File

@@ -163,7 +163,7 @@ int main(void)
if (!mk_short_channel_id(&scid, i, i-1, 0))
abort();
chan = new_chan(rstate, &scid, &ids[i], &ids[i-1],
AMOUNT_SAT(1000000));
AMOUNT_SAT(1000000), NULL);
hc = &chan->half[node_id_idx(&ids[i-1], &ids[i])];
hc->bcast.index = 1;
@@ -183,7 +183,7 @@ int main(void)
if (!mk_short_channel_id(&scid, i, 1, 0))
abort();
chan = new_chan(rstate, &scid, &ids[i], &ids[1],
AMOUNT_SAT(1000000));
AMOUNT_SAT(1000000), NULL);
hc = &chan->half[node_id_idx(&ids[1], &ids[i])];
hc->bcast.index = 1;
hc->base_fee = 1 << i;