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

Handle monotonic clock going backwards during runtime #1692

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

We've had some users complain that duration_since is panic'ing
for them. This is possible if the machine being run on is buggy and
the "monotonic clock" goes backwards, which sadly some ancient
systems can do.

Rust addressed this issue in 1.60 by forcing
Instant::duration_since to not panic if the machine is buggy
(and time goes backwards), but for users on older rust versions we
do the same by hand here.

We've had some users complain that `duration_since` is panic'ing
for them. This is possible if the machine being run on is buggy and
the "monotonic clock" goes backwards, which sadly some ancient
systems can do.

Rust addressed this issue in 1.60 by forcing
`Instant::duration_since` to not panic if the machine is buggy
(and time goes backwards), but for users on older rust versions we
do the same by hand here.
@TheBlueMatt TheBlueMatt added this to the 0.0.111 milestone Sep 2, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #1692 (82474d3) into main (b84b53a) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1692      +/-   ##
==========================================
+ Coverage   90.77%   90.83%   +0.06%     
==========================================
  Files          80       85       +5     
  Lines       44763    46221    +1458     
  Branches    44763    46221    +1458     
==========================================
+ Hits        40632    41987    +1355     
- Misses       4131     4234     +103     
Impacted Files Coverage Δ
lightning/src/util/time.rs 81.53% <100.00%> (+0.28%) ⬆️
lightning/src/chain/keysinterface.rs 92.54% <0.00%> (-1.06%) ⬇️
lightning/src/ln/wire.rs 61.99% <0.00%> (-0.93%) ⬇️
lightning/src/chain/onchaintx.rs 94.02% <0.00%> (-0.89%) ⬇️
lightning/src/util/config.rs 66.66% <0.00%> (-0.78%) ⬇️
lightning/src/util/test_utils.rs 77.49% <0.00%> (-0.62%) ⬇️
lightning/src/ln/onion_utils.rs 94.88% <0.00%> (-0.57%) ⬇️
lightning/src/ln/msgs.rs 85.74% <0.00%> (-0.54%) ⬇️
lightning/src/ln/peer_handler.rs 56.76% <0.00%> (-0.50%) ⬇️
lightning/src/ln/monitor_tests.rs 99.55% <0.00%> (-0.45%) ⬇️
... and 32 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@TheBlueMatt TheBlueMatt merged commit f99301d into lightningdevkit:main Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants