gossip: Fixing minor issues

Thanks @rustyrussell for the review ^^
This commit is contained in:
Christian Decker 2016-12-21 23:49:01 +01:00 committed by Rusty Russell
parent 95bc8f6987
commit 570003235e
2 changed files with 4 additions and 5 deletions

View File

@ -263,8 +263,7 @@ void handle_node_announcement(
} }
node->last_timestamp = msg->timestamp; node->last_timestamp = msg->timestamp;
if (node->hostname) node->hostname = tal_free(node->hostname);
node->hostname = tal_free(node->hostname);
node->hostname = read_ip(node, &msg->ipv6); node->hostname = read_ip(node, &msg->ipv6);
node->port = msg->port; node->port = msg->port;
memcpy(node->rgb_color, msg->rgb_color, 3); memcpy(node->rgb_color, msg->rgb_color, 3);
@ -296,6 +295,7 @@ static void broadcast_channel_update(struct lightningd_state *dstate, struct pee
msg->channel_id.outnum = peer->anchor.index; msg->channel_id.outnum = peer->anchor.index;
msg->flags = pubkey_cmp(&dstate->id, peer->id) > 0; msg->flags = pubkey_cmp(&dstate->id, peer->id) > 0;
msg->expiry = dstate->config.min_htlc_expiry; msg->expiry = dstate->config.min_htlc_expiry;
//FIXME(cdecker) Make the minimum HTLC configurable
msg->htlc_minimum_msat = 1; msg->htlc_minimum_msat = 1;
msg->fee_base_msat = dstate->config.fee_base; msg->fee_base_msat = dstate->config.fee_base;
msg->fee_proportional_millionths = dstate->config.fee_per_satoshi; msg->fee_proportional_millionths = dstate->config.fee_per_satoshi;

View File

@ -153,7 +153,7 @@ struct node_connection *get_connection_by_cid(const struct lightningd_state *dst
num_conn = tal_count(n->out); num_conn = tal_count(n->out);
for (i = 0; i < num_conn; i++){ for (i = 0; i < num_conn; i++){
c = n->out[i]; c = n->out[i];
if (memcmp(&c->channel_id, chanid, sizeof(*chanid)) == 0 && if (structeq(&c->channel_id, chanid) &&
(c->flags&0x1) == direction) (c->flags&0x1) == direction)
return c; return c;
} }
@ -196,7 +196,6 @@ get_or_make_connection(struct lightningd_state *dstate,
nc = tal(dstate, struct node_connection); nc = tal(dstate, struct node_connection);
nc->src = from; nc->src = from;
nc->dst = to; nc->dst = to;
memset(&nc->channel_id, 0, sizeof(nc->channel_id));
nc->channel_announcement = NULL; nc->channel_announcement = NULL;
nc->channel_update = NULL; nc->channel_update = NULL;
log_add(dstate->base_log, " = %p (%p->%p)", nc, from, to); log_add(dstate->base_log, " = %p (%p->%p)", nc, from, to);
@ -570,7 +569,7 @@ void sync_routing_table(struct lightningd_state *dstate, struct peer *peer)
if (nc->channel_update) if (nc->channel_update)
queue_pkt_nested(peer, WIRE_CHANNEL_UPDATE, nc->channel_update); queue_pkt_nested(peer, WIRE_CHANNEL_UPDATE, nc->channel_update);
} }
if (n->node_announcement) if (n->node_announcement && num_edges > 0)
queue_pkt_nested(peer, WIRE_NODE_ANNOUNCEMENT, n->node_announcement); queue_pkt_nested(peer, WIRE_NODE_ANNOUNCEMENT, n->node_announcement);
} }
} }