mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
listpeers: correctly display features on reconnect.
peer features are only kept for connected peers (as they can change), but we didn't update them on reconnect. The main effect was that after a restart we displayed the features as empty, even after reconnect. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
f5143d9549
commit
162adfdf12
@@ -1002,7 +1002,7 @@ def test_forget_channel(node_factory):
|
||||
|
||||
|
||||
def test_peerinfo(node_factory, bitcoind):
|
||||
l1, l2 = node_factory.line_graph(2, fundchannel=False)
|
||||
l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'may_reconnect': True})
|
||||
# Gossiping but no node announcement yet
|
||||
assert l1.rpc.getpeer(l2.info['id'])['connected']
|
||||
assert len(l1.rpc.getpeer(l2.info['id'])['channels']) == 0
|
||||
@@ -1024,6 +1024,16 @@ def test_peerinfo(node_factory, bitcoind):
|
||||
assert only_one(nodes1)['global_features'] == peer1['global_features']
|
||||
assert only_one(nodes2)['global_features'] == peer2['global_features']
|
||||
|
||||
assert l1.rpc.getpeer(l2.info['id'])['local_features'] == '8a'
|
||||
assert l2.rpc.getpeer(l1.info['id'])['local_features'] == '8a'
|
||||
|
||||
# If it reconnects after db load, it should know features.
|
||||
l1.restart()
|
||||
wait_for(lambda: l1.rpc.getpeer(l2.info['id'])['connected'])
|
||||
wait_for(lambda: l2.rpc.getpeer(l1.info['id'])['connected'])
|
||||
assert l1.rpc.getpeer(l2.info['id'])['local_features'] == '8a'
|
||||
assert l2.rpc.getpeer(l1.info['id'])['local_features'] == '8a'
|
||||
|
||||
# Close the channel to forget the peer
|
||||
with pytest.raises(RpcError, match=r'Channel close negotiation not finished'):
|
||||
l1.rpc.close(chan, False, 0)
|
||||
|
||||
Reference in New Issue
Block a user