Announce emission time can go backwards after a reboot
On Arduino targets the 5-byte emission time in the announce random blob comes from OS::time(), i.e. millis() plus a persisted offset. Python RNS only accepts a new announce for a known destination (same or fewer hops) if that time is greater than the stored one, so any step back in the clock makes peers drop the node's announces.
Two cases from reading Reticulum.cpp (master, 5dd9af9):
-
Up to 10 minutes back after any reboot. The offset is written at start-up and then every 600 s (
_last_time_persist + 600in loop()). On boot it is read back and advanced by 1 ms only, so the clock restarts at the last persisted value, up to ~10 min behind the last emitted announce. The boot announce, and later ones until the clock catches up, are dropped by peers that saw the previous ones. -
Reset after ~49.7 days of cumulative uptime. writeTimeOffset() stores OS::ltime() in ms, and readTimeOffset() discards values above 4294967295 ("potentially corrupt"). Once cumulative uptime passes 2^32 ms, the next reboot starts the clock from zero, and peers ignore the node's announces until their path entry expires (up to 7 days).
I hit the first case on a Heltec T114 (nRF52840): after a reset, rnpath -t on the neighbouring rnsd showed the path expiry not refreshing even though the node was announcing.
Possible fixes:
- on boot, advance the offset by at least the persist interval (600 s) instead of 1 ms;
- raise the sanity limit in readTimeOffset() (e.g. 2^40 ms, ~35 years) or check something other than size.
Related: #48 introduced the timestamp in the random blob, which makes the emission time matter for announce acceptance.