diff --git a/gossipd/gossip.c b/gossipd/gossip.c index 395b4b7c3..bdfdd128d 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -1810,6 +1810,7 @@ static struct io_plan *handle_disable_channel(struct io_conn *conn, tal_t *tmpctx = tal_tmpctx(msg); struct short_channel_id scid; u8 direction; + struct routing_channel *chan; struct node_connection *nc; bool active; u16 flags, cltv_expiry_delta; @@ -1824,15 +1825,15 @@ static struct io_plan *handle_disable_channel(struct io_conn *conn, goto fail; } - nc = get_connection_by_scid(daemon->rstate, &scid, direction); - - if (!nc) { + chan = get_channel(daemon->rstate, &scid); + if (!chan || !chan->connections[direction]) { status_trace( "Unable to find channel %s/%d", type_to_string(msg, struct short_channel_id, &scid), direction); goto fail; } + nc = chan->connections[direction]; status_trace("Disabling channel %s/%d, active %d -> %d", type_to_string(msg, struct short_channel_id, &scid), diff --git a/gossipd/routing.c b/gossipd/routing.c index 97821ac9f..6dccd95ea 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -196,19 +196,6 @@ static void destroy_routing_channel(struct routing_channel *chan, tal_free(chan->nodes[1]); } -/* FIXME: All users of this are confused. */ -struct node_connection *get_connection_by_scid(const struct routing_state *rstate, - const struct short_channel_id *scid, - const u8 direction) -{ - struct routing_channel *chan = get_channel(rstate, scid); - - if (chan == NULL) - return NULL; - else - return chan->connections[direction]; -} - static void destroy_node_connection(struct node_connection *nc, struct routing_channel *chan) { diff --git a/gossipd/routing.h b/gossipd/routing.h index bcba75364..49a49cd28 100644 --- a/gossipd/routing.h +++ b/gossipd/routing.h @@ -188,12 +188,6 @@ struct routing_channel *new_routing_channel(struct routing_state *rstate, const struct pubkey *id1, const struct pubkey *id2); -/* Given a short_channel_id, retrieve the matching connection, or NULL if it is - * unknown. */ -struct node_connection *get_connection_by_scid(const struct routing_state *rstate, - const struct short_channel_id *schanid, - const u8 direction); - /* Handlers for incoming messages */ /**