mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
peer_control: don't list opening channels as connected=false.
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 <rusty@rustcorp.com.au>
This commit is contained in:
parent
429c853fac
commit
daa14f48f2
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user