NetDB, I2CP: Fix tunnels going yellow for several minutes (Gitlab #487)
Caused by multiple leasesets with same 1-second-resolution publish time. Newer leasesets were not stored locally or to floodfills, but the tunnel pool had enough tunnels and so did not request another leaseset until those tunnels expired.
As the issue would have always resolved within 10 minutes (when the current lease expired), the watchdog never barked, and no errors were logged. The yellow icon in the sidebar was the only clue.
Issue dates back to the introduction of LS2, but has been getting worse as tunnel builds become faster, and more apparent as the network has gotten more reliable.
The typical scenario is a 2-tunnel LS, and tunnel test fails one tunnel the pool removes it and a one-lease LS is built. The pool builds a new tunnel within a few hundred ms, a new two-lease LS is built, but it isn't stored or published. The old LS expires but until the new tunnels expire, a new LS isn't created and stored.
Related issue was probably causing encrypted LS stores to intermittently fail.
Fixes:
- Ensure each LS signed by the client has a publish time at least one second later than the previous one
- Bypass age checks when storing local LS
- Add isNewer() method to correctly compare times for both LS1 and LS2
- Ensure all LS2 age checks use publish time, not earliest lease
- Add multiple notes and javadocs about LS2 age checks
- Add log warning if local LS expires and is removed
Closes #487 (closed)