-
Notifications
You must be signed in to change notification settings - Fork 266
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
Send to channel route #1537
Send to channel route #1537
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1537 +/- ##
==========================================
- Coverage 87.19% 87.17% -0.03%
==========================================
Files 139 139
Lines 10871 10882 +11
==========================================
+ Hits 9479 9486 +7
- Misses 1392 1396 +4
|
case class PredefinedNodeRoute(nodes: Seq[PublicKey]) extends PredefinedRoute { | ||
override def isEmpty = nodes.isEmpty | ||
override def targetNodeId: PublicKey = nodes.last | ||
} | ||
case class PredefinedChannelRoute(targetNodeId: PublicKey, channels: Seq[ShortChannelId]) extends PredefinedRoute { | ||
override def isEmpty = channels.isEmpty | ||
} |
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.
The isEmpty
method seems to have a different meaning between PredefinedNodeRoute
and PredefinedChannelRoute
. There could be a valid empty channel route which would be a direct payment.
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 it works the way it is, a direct payment needs one channel to be specified.
val route = hops match { | ||
case Left(shortChannelIds) => PredefinedChannelRoute(invoice.nodeId, shortChannelIds) | ||
case Right(nodeIds) => PredefinedNodeRoute(nodeIds) | ||
} |
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.
Here there is an inconsistency that is related to my other comment. Should we define the node route as nodeIds :+ invoice.nodeId
?
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.
There was an inconsistency in that channel routes used the invoice's nodeId
as targetNodeId
, whereas in node routes we implied that the last nodeId
would match the invoice's nodeId
.
I added an explicit check in e802bc2 to reject node routes that are blatantly invalid.
While `sendtoroute` was letting you provide a custom route as a list of nodes, it made it difficult to have fine-grain control over the channels used by payments. The API now allows choosing the exact channels that will be used for the payment; in particular, this will be helpful when consolidating and rebalancing multiple channels to a given node. Fixes #1472
#1520 introduced a regression in the serialization of channel data, impacted the `channels` and `channel` APIs. We restrict the custom command response serializer to revert to the previous behavior.
1250103
to
2c32723
Compare
Codecov Report
@@ Coverage Diff @@
## master #1537 +/- ##
==========================================
- Coverage 87.30% 87.11% -0.19%
==========================================
Files 139 139
Lines 10896 10915 +19
Branches 489 451 -38
==========================================
- Hits 9513 9509 -4
- Misses 1383 1406 +23
|
This reverts commit e802bc2.
While
sendtoroute
was letting you provide a custom route as a list of nodes, it made it difficult to have fine-grain control over the channels used by payments.The API now allows choosing the exact channels that will be used for the payment; in particular, this will be helpful when consolidating and rebalancing multiple channels to a given node.
Fixes #1472
We also fix a serialization regression introduced in #1520