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

routing: add cltv limit #2640

Merged
merged 6 commits into from Mar 27, 2019
Merged

Conversation

joostjager
Copy link
Collaborator

This PR adds a maximum cltv limit for payments, similar to the currently existing fee limit.

@Roasbeef Roasbeef added this to the 0.6 milestone Feb 13, 2019
@Roasbeef Roasbeef added enhancement Improvements to existing features / behaviour routing rpc Related to the RPC interface cli Related to the command line interface labels Feb 13, 2019
Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

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

Somewhat unrelated -- I noticed that we check for the fee limit when constructing the route from the path. Is there a reason that check is still needed since we already do it within path finding?

routing/pathfind.go Outdated Show resolved Hide resolved
routing/pathfind_test.go Outdated Show resolved Hide resolved
cmd/lncli/commands.go Show resolved Hide resolved
lnrpc/rpc.proto Show resolved Hide resolved
routing/pathfind_test.go Show resolved Hide resolved
@joostjager
Copy link
Collaborator Author

Somewhat unrelated -- I noticed that we check for the fee limit when constructing the route from the path. Is there a reason that check is still needed since we already do it within path finding?

I don't think there is. It is a sanity check, but I think it can be removed. I didn't bother adding another one for cltvLimit.

@joostjager
Copy link
Collaborator Author

@wpaulino PTAL

@wpaulino
Copy link
Contributor

I don't think there is. It is a sanity check, but I think it can be removed. I didn't bother adding another one for cltvLimit.

Gotcha, would be nice to remove it in a follow-up PR then.

@joostjager
Copy link
Collaborator Author

I don't think there is. It is a sanity check, but I think it can be removed. I didn't bother adding another one for cltvLimit.

Gotcha, would be nice to remove it in a follow-up PR then.

Yes, I can do that.

@joostjager
Copy link
Collaborator Author

@wpaulino ptal

Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

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

LGTM 🌵

routing/pathfind.go Show resolved Hide resolved
routing/router.go Show resolved Hide resolved
@joostjager
Copy link
Collaborator Author

@halseth comments replied to, ptal

@joostjager
Copy link
Collaborator Author

Rebased

@joostjager joostjager force-pushed the cltv-limit branch 2 times, most recently from 4738b27 to d3ef006 Compare March 6, 2019 14:27
@joostjager
Copy link
Collaborator Author

I don't think there is. It is a sanity check, but I think it can be removed. I didn't bother adding another one for cltvLimit.

Gotcha, would be nice to remove it in a follow-up PR then.

It is happening in #2497

@wpaulino
Copy link
Contributor

Needs a rebase.

@@ -2836,6 +2837,11 @@ func extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPaymentIntent, error
payIntent.outgoingChannelID = &rpcPayReq.OutgoingChanId
}

// Take cltv limit from request if set.
if rpcPayReq.CltvLimit != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

This check wouldn't be needed if we used 0 to indicate no limit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is the same discussion as above. The conversion is done as early as possible to prevent having to deal with the magic value further down the call stack.

cmd/lncli/commands.go Outdated Show resolved Hide resolved
routing/pathfind.go Outdated Show resolved Hide resolved
This condition may be caused by a bug somewhere else in the system.
Expose it here as a warn log line.
@joostjager
Copy link
Collaborator Author

ptal

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 🕺

@halseth halseth merged commit 4d8100c into lightningnetwork:master Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface enhancement Improvements to existing features / behaviour routing rpc Related to the RPC interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants