Skip to content

Commit

Permalink
peer_control: don't list opening channels as connected=false.
Browse files Browse the repository at this point in the history
I saw a failure in test_funding_fail():
	assert l2.rpc.listpeers()['peers'][0]['connected']

This can happen if l2 hasn't yet handed back to gossipd.  Turns out
we didn't mark uncommitted channels as connected:

	[{'id': '03afa3c78bb39217feb8aac308852e6383d59409839c2b91955b2d992421f4a41e', 'connected': False, 'channels': [{'state': 'OPENINGD', 'owner': 'lightning_openingd', 'funder': 'REMOTE', 'status': ['Incoming channel: accepted, now waiting for them to create funding tx']}]}]

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Apr 5, 2018
1 parent 429c853 commit daa14f4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,14 @@ static void gossipd_getpeers_complete(struct subd *gossip, const u8 *msg,

json_object_start(response, NULL);
json_add_pubkey(response, "id", &p->id);
channel = peer_active_channel(p);
connected = (channel && channel->owner != NULL);

/* Channel is also connected if uncommitted channel */
if (p->uncommitted_channel)
connected = true;
else {
channel = peer_active_channel(p);
connected = channel && channel->owner;
}
json_add_bool(response, "connected", connected);

if (connected) {
Expand Down

0 comments on commit daa14f4

Please sign in to comment.