Skip to content

Time out incoming HTLCs when we reach cltv_expiry (+ test) #252

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

Closed

Conversation

TheBlueMatt
Copy link
Collaborator

We only do this for incoming HTLCs directly as we rely on channel
closure and HTLC-Timeout broadcast to fail any HTLCs which we
relayed onwards where our next-hop doesn't update_fail in time.

Partially addresses #215. Note that the failing of inbound HTLCs which we forwarded based on the confirming of downstream HTLC-Timeout transactions is not yet implemented, but that will be the rest of #215.

We only do this for incoming HTLCs directly as we rely on channel
closure and HTLC-Timeout broadcast to fail any HTLCs which we
relayed onwards where our next-hop doesn't update_fail in time.
@@ -2567,10 +2574,27 @@ impl ChainListener for ChannelManager {
}
true
});
channel_state.claimable_htlcs.retain(|payment_hash, htlcs| {
htlcs.retain(|htlc| {
if htlc.cltv_expiry <= height { // XXX: Or <?
Copy link

Choose a reason for hiding this comment

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

Sorry what means "XXX: or <?" ? You want to substract a safe delay to height ?

Copy link
Collaborator Author

@TheBlueMatt TheBlueMatt Nov 16, 2018

Choose a reason for hiding this comment

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

Oops, lol, ffs, I really need to double-check my own commits before opening PRs, I blame sleep deprivation after 16 hours of being in a plane, thanks for reviewing...That was a note to myself that I'm not sure if the comparison was supposed to be <= or <, I'll double check and fix the PR.

@ariard
Copy link

ariard commented Nov 16, 2018

utACK, will handle the second part after #198, get done, same kind of problems

@ariard
Copy link

ariard commented Dec 8, 2018

As mentionned in #215, we need also to fail AwatingRemoteRAA::AddHTLC if they timed out, so implemented there ariard@56d72cf need to add test and fix the height comparison as for yours (maybe we want to subtract a safe delay to height?)

On the last point, don't get you on "failing of inbound HTLCs which we forwarded based on the confirming of downstream HTLC-Timeout transactions" ? If we detect an onchain channel closure why send back UpdateFail to downstream remote peer ?

@TheBlueMatt
Copy link
Collaborator Author

Now a part of #441, including @ariard's commit as well (though no test for that bit yet).

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.

2 participants