Skip to content

Drop system clock calls for PendingHTLCsForwardable events. #351

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

Merged
merged 2 commits into from
Jul 19, 2019

Conversation

TheBlueMatt
Copy link
Collaborator

Instead, return a Duration and let the user do the work of waiting.
This is one of only a handful of steps to make us
mostly-syscall-free, at least enough to run in WASM according to
elichai.

  • 1 extra commit to remove an entirely-useless field in channel that relied on Instant::now().

Instead, return a Duration and let the user do the work of waiting.
This is one of only a handful of steps to make us
mostly-syscall-free, at least enough to run in WASM according to
elichai.
@elichai
Copy link
Contributor

elichai commented Jul 18, 2019

Cool :)

@elichai
Copy link
Contributor

elichai commented Jul 18, 2019

It's still calling SystemTime in the Key interface (https://github.com/rust-bitcoin/rust-lightning/blob/master/src/chain/keysinterface.rs)

Copy link

@ariard ariard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK e2a9ed7, comments are already there API design issues.

That's cool, user can still hack its own monotonic counter if he can't rely on time syscall and wrappers

@@ -133,14 +132,13 @@ struct OutboundHTLCOutput {

/// See AwaitingRemoteRevoke ChannelState for more info
enum HTLCUpdateAwaitingACK {
AddHTLC {
AddHTLC { // TODO: Time out if we're getting close to cltv_expiry
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, timeout here is only relevant if you are last peer in the payment route, don't have the preimage and can initiate the canceling walk back?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And furthermore, I've a doubt where the cltv_expiry field of AddHTLC should be used in our API, I mean we have fail_htlc_backwards, which is public but how API consumer is leaded to be aware of delay ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are HTLCs which we accepted for relay but which we have not yet added to the outbound channel (as we were waiting for a remote revoke_and_ack at the time we received them, or were otherwise unable to forward them). AFAIR, we will never fail these HTLCs backwards as the ChannelMonitor isn't even aware of them at this time.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay gotcha, not implemented yet, it's going with other TODO in Channel::update_add_htlc, need to pass height in process_pending_htlc_forwards I guess

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just fail them backwards if they're still waiting to be forwarded as the CLTV starts to get close in a hook from block_connected.

@TheBlueMatt
Copy link
Collaborator Author

@elichai right, I'm aware, I have an alternative to #352 which also drops most of the rng usage inside the library and fixes that then coming up soon.

@TheBlueMatt TheBlueMatt merged commit fbd58b4 into lightningdevkit:master Jul 19, 2019
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.

3 participants