Skip to content

lnwire+htlcswitch: report htlc accept height#3414

Merged
joostjager merged 5 commits intolightningnetwork:masterfrom
joostjager:report-accept-height
Sep 16, 2019
Merged

lnwire+htlcswitch: report htlc accept height#3414
joostjager merged 5 commits intolightningnetwork:masterfrom
joostjager:report-accept-height

Conversation

@joostjager
Copy link
Contributor

@joostjager joostjager commented Aug 19, 2019

Implements lightning/bolts#608 by extending the incorrect_or_unknown_payment_details message with the height at which the failed htlc was accepted.

@joostjager joostjager changed the title lnwire+htlcswitch: report htlc accept height [wip] [no review] lnwire+htlcswitch: report htlc accept height [wip] [don't review] Aug 23, 2019
@joostjager joostjager changed the title lnwire+htlcswitch: report htlc accept height [wip] [don't review] lnwire+htlcswitch: report htlc accept height Sep 5, 2019
@joostjager joostjager force-pushed the report-accept-height branch 2 times, most recently from 2ca1e27 to ae146db Compare September 5, 2019 11:42
Copy link
Contributor

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

first pass looks pretty good, only one rpc-related comment 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps something like accept_height, to mimic what the invoice htlc's will show?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about that, but wasn't sure. The idea of the message Failure is that it isn't a oneof to keep it simple. Fields are reused in different messages. This height is meant as a generic height field associated with a failure. But yes, I could also make it more specific.

Copy link
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

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

Looks more or less good to me :)

Copy link
Contributor

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

LGTM! great commit structure 👌

@cfromknecht
Copy link
Contributor

invoices/invoiceregistry_test.go:127:29: undefined: testInvoiceCltvDelta

@joostjager
Copy link
Contributor Author

Test failure fixed

Copy link
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

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

LGTM 👡

Copy link
Contributor

Choose a reason for hiding this comment

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

add similar comment as for the settle case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment added. While writing the comment, I also realized that the invoice update could be a bit stricter. See commit channeldb+invoices: make htlc cancelation stricter

@joostjager joostjager force-pushed the report-accept-height branch 2 times, most recently from 343c376 to 81d6637 Compare September 13, 2019 07:40
@joostjager joostjager requested a review from halseth September 13, 2019 07:42
@joostjager
Copy link
Contributor Author

Requires #3503 to be merged so that the linter is tamed first.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that we can cancel a settled one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline. No htlc should be in the settled state here, because then the invoice state would have been settled. Added extra check to return an error if this happens.

Previously it was possible to cancel a canceled htlc. This would
subtract the htlc amount from the invoice amount again.
This commit modifies hodl htlc notification from invoice registry from a
single notification per hash to distinct notifications per htlc. This
prepares for htlc-specific information (accept height) to be added to the
notification.
This is a preparation for passing back the accept height in the
incorrect payment details failure message to the sender.
This test relied on specific internals of the failure encode function.
Changes to failure message pointer receiver everywhere subtly broke this
test.
Extends the invalid payment details failure with the new accept height
field. This allows sender to distinguish between a genuine invalid
details situation and a delay caused by intermediate nodes.
@joostjager joostjager merged commit 95502da into lightningnetwork:master Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants