Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scary INFO message on first connection to peer after startup #6140

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lightningd/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,10 @@ void channel_set_billboard(struct channel *channel, bool perm, const char *str)

static void channel_err(struct channel *channel, const char *why)
{
/* Nothing to do if channel isn't actually owned! */
if (!channel->owner)
return;

log_info(channel->log, "Peer transient failure in %s: %s",
channel_state_name(channel), why);

Expand Down
30 changes: 30 additions & 0 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4377,3 +4377,33 @@ def test_peer_disconnected_reflected_in_channel_state(node_factory):

wait_for(lambda: only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['connected'] is False)
wait_for(lambda: only_one(l1.rpc.listpeerchannels(l2.info['id'])['channels'])['peer_connected'] is False)


@pytest.mark.developer("needs dev-no-reconnect")
def test_reconnect_no_additional_transient_failure(node_factory, bitcoind):
l1, l2 = node_factory.line_graph(2, opts=[{'may_reconnect': True},
{'may_reconnect': True,
'dev-no-reconnect': None}])
l1id = l1.info['id']
l2id = l2.info['id']
# We wait until conenction is established and channel is NORMAL
l2.daemon.wait_for_logs([f"{l1id}-connectd: Handed peer, entering loop",
f"{l1id}-chan#1: State changed from CHANNELD_AWAITING_LOCKIN to CHANNELD_NORMAL"])
# We now stop l1
l1.stop()
# We wait for l2 to disconnect, ofc we also see an expected "Peer transient failure" here.
l2.daemon.wait_for_logs([f"{l1id}-channeld-chan#1: Peer connection lost",
f"{l1id}-lightningd: peer_disconnect_done",
f"{l1id}-chan#1: Peer transient failure in CHANNELD_NORMAL: channeld: Owning subdaemon channeld died"])

# When we restart l1 we should not see another Peer transient failure message.
offset1 = l1.daemon.logsearch_start
l1.start()

# We wait until l2 is fine again with l1
l2.daemon.wait_for_log(f"{l1id}-connectd: Handed peer, entering loop")

time.sleep(5)

# We should not see a "Peer transient failure" after restart of l1
assert not l1.daemon.is_in_log(f"{l2id}-chan#1: Peer transient failure in CHANNELD_NORMAL: Disconnected", start=offset1)