Increase our PING_TIMER to ten seconds, from five.

Because many lightning nodes can take quite some time to respond to
pings, the five second ping timer can sometimes cause spurious
disconnects even though a peer is online. However, in part as a
response to mobile users where a connection may be lost as result
of only a short time with the app in a "paused" state, we had a
rather aggressive ping time to ensure we would disconnect quickly.

However, since we now just used a fixed time for the "went to
sleep" detection, we can somewhat increase the ping timer. We still
want to be fairly aggressive to avoid sending HTLCs to a peer that
is offline, but the tradeoff between spurious disconnections and
stuck payments is likely doesn't need to be quite as aggressive.
This commit is contained in:
Matt Corallo 2022-01-20 23:42:56 +00:00
parent 8f5023a006
commit 2d3a210897

View File

@ -61,7 +61,7 @@ const FRESHNESS_TIMER: u64 = 60;
const FRESHNESS_TIMER: u64 = 1;
#[cfg(all(not(test), not(debug_assertions)))]
const PING_TIMER: u64 = 5;
const PING_TIMER: u64 = 10;
/// Signature operations take a lot longer without compiler optimisations.
/// Increasing the ping timer allows for this but slower devices will be disconnected if the
/// timeout is reached.