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

OffersMessageHandler impl for ChannelManager accesses time #3097

Closed
TheBlueMatt opened this issue Jun 5, 2024 · 2 comments · Fixed by #3249
Closed

OffersMessageHandler impl for ChannelManager accesses time #3097

TheBlueMatt opened this issue Jun 5, 2024 · 2 comments · Fixed by #3249
Labels
blocked on rust-bitcoin Blocked until we update rust-bitcoin/etc
Milestone

Comments

@TheBlueMatt
Copy link
Collaborator

We have users who can't access time due to being in WASM, and while we'd like to move them to no-std, we can't do that until we get to rust-bitcoin 0.32. Thus, for our next release, we either need to upgrade to rust-bitcoin 0.32 or we need to drop the time accesses in the OffersMessageHandler impl.

@jkczyz
Copy link
Contributor

jkczyz commented Jun 5, 2024

Note that timer_tick_occurred is also affected for removing stale payments (i.e., stuck AwaitingInvoice).

#[cfg(feature = "std")]
let duration_since_epoch = std::time::SystemTime::now()
.duration_since(std::time::SystemTime::UNIX_EPOCH)
.expect("SystemTime::now() should come after SystemTime::UNIX_EPOCH");
#[cfg(not(feature = "std"))]
let duration_since_epoch = Duration::from_secs(
self.highest_seen_timestamp.load(Ordering::Acquire).saturating_sub(7200) as u64
);
self.pending_outbound_payments.remove_stale_payments(
duration_since_epoch, &self.pending_events
);

@TheBlueMatt
Copy link
Collaborator Author

We can avoid having to fix this issue if we do #3100 and uncouple the LDK no-std feature from rust-bitcoin no-std.

@valentinewallace valentinewallace added the blocked on rust-bitcoin Blocked until we update rust-bitcoin/etc label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked on rust-bitcoin Blocked until we update rust-bitcoin/etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants