Browse Source

gossip: Store channel capacity in the routing table

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
2abf72e7df
  1. 2
      gossipd/gossip.c
  2. 3
      gossipd/routing.c
  3. 3
      gossipd/routing.h

2
gossipd/gossip.c

@ -1818,7 +1818,7 @@ static struct io_plan *handle_txout_reply(struct io_conn *conn,
if (!fromwire_gossip_get_txout_reply(msg, msg, &scid, &satoshis, &outscript))
master_badmsg(WIRE_GOSSIP_GET_TXOUT_REPLY, msg);
if (handle_pending_cannouncement(daemon->rstate, &scid, outscript))
if (handle_pending_cannouncement(daemon->rstate, &scid, satoshis, outscript))
send_node_announcement(daemon);
return daemon_conn_read_next(conn, &daemon->master);

3
gossipd/routing.c

@ -225,6 +225,7 @@ struct chan *new_chan(struct routing_state *rstate,
chan->channel_announcement = NULL;
chan->channel_announce_msgidx = 0;
chan->public = false;
chan->satoshis = 0;
n = tal_count(n2->chans);
tal_resize(&n2->chans, n+1);
@ -646,6 +647,7 @@ const struct short_channel_id *handle_channel_announcement(
bool handle_pending_cannouncement(struct routing_state *rstate,
const struct short_channel_id *scid,
const u64 satoshis,
const u8 *outscript)
{
bool local;
@ -706,6 +708,7 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
/* Channel is now public. */
chan->public = true;
chan->satoshis = satoshis;
/* Save channel_announcement. */
tal_free(chan->channel_announcement);

3
gossipd/routing.h

@ -61,6 +61,8 @@ struct chan {
/* Is this a public channel, or was it only added locally? */
bool public;
u64 satoshis;
};
struct node {
@ -210,6 +212,7 @@ handle_channel_announcement(struct routing_state *rstate,
*/
bool handle_pending_cannouncement(struct routing_state *rstate,
const struct short_channel_id *scid,
const u64 satoshis,
const u8 *txscript);
void handle_channel_update(struct routing_state *rstate, const u8 *update);
void handle_node_announcement(struct routing_state *rstate, const u8 *node);

Loading…
Cancel
Save