-
Notifications
You must be signed in to change notification settings - Fork 407
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
Drop system clock calls for PendingHTLCsForwardable events. #351
Conversation
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.
Cool :) |
It's still calling SystemTime in the Key interface (https://github.com/rust-bitcoin/rust-lightning/blob/master/src/chain/keysinterface.rs) |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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.