Increase our PING_TIMER to ten seconds, from five. 022-01-no-disconnect-on-slow-persist
authorMatt Corallo <git@bluematt.me>
Thu, 20 Jan 2022 23:42:56 +0000 (23:42 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 21 Jan 2022 00:36:59 +0000 (00:36 +0000)
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.

lightning-background-processor/src/lib.rs

index 363dfba93ce407efce441fc69af536fbbcd53fda..c3be857a3611f09490902386f1008b503f271b91 100644 (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.