diff --git a/daemon/p2p_announce.c b/daemon/p2p_announce.c index 2e90b792a..12d89b044 100644 --- a/daemon/p2p_announce.c +++ b/daemon/p2p_announce.c @@ -263,8 +263,7 @@ void handle_node_announcement( } 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->port = msg->port; 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->flags = pubkey_cmp(&dstate->id, peer->id) > 0; msg->expiry = dstate->config.min_htlc_expiry; + //FIXME(cdecker) Make the minimum HTLC configurable msg->htlc_minimum_msat = 1; msg->fee_base_msat = dstate->config.fee_base; msg->fee_proportional_millionths = dstate->config.fee_per_satoshi; diff --git a/daemon/routing.c b/daemon/routing.c index b7957c89a..6351bec9c 100644 --- a/daemon/routing.c +++ b/daemon/routing.c @@ -153,7 +153,7 @@ struct node_connection *get_connection_by_cid(const struct lightningd_state *dst num_conn = tal_count(n->out); for (i = 0; i < num_conn; i++){ c = n->out[i]; - if (memcmp(&c->channel_id, chanid, sizeof(*chanid)) == 0 && + if (structeq(&c->channel_id, chanid) && (c->flags&0x1) == direction) return c; } @@ -196,7 +196,6 @@ get_or_make_connection(struct lightningd_state *dstate, nc = tal(dstate, struct node_connection); nc->src = from; nc->dst = to; - memset(&nc->channel_id, 0, sizeof(nc->channel_id)); nc->channel_announcement = NULL; nc->channel_update = NULL; 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) 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); } }