-
Notifications
You must be signed in to change notification settings - Fork 2.3k
routing: inbound fees send support #6934
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
Changes from all commits
e0a0804
9d4251c
d97e7d3
0bae781
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,9 @@ type DirectedChannel struct { | |
| // source, so we're always interested in the edge that arrives to us | ||
| // from the other node. | ||
| InPolicy *models.CachedEdgePolicy | ||
|
|
||
| // Inbound fees of this node. | ||
| InboundFee lnwire.Fee | ||
| } | ||
|
|
||
| // DeepCopy creates a deep copy of the channel, including the incoming policy. | ||
|
|
@@ -220,6 +223,14 @@ func (c *GraphCache) updateOrAddEdge(node route.Vertex, edge *DirectedChannel) { | |
| func (c *GraphCache) UpdatePolicy(policy *models.ChannelEdgePolicy, fromNode, | ||
| toNode route.Vertex, edge1 bool) { | ||
|
|
||
| // Extract inbound fee if possible and available. If there is a decoding | ||
| // error, ignore this policy. | ||
| var inboundFee lnwire.Fee | ||
| _, err := policy.ExtraOpaqueData.ExtractRecords(&inboundFee) | ||
| if err != nil { | ||
| return | ||
| } | ||
|
|
||
| c.mtx.Lock() | ||
| defer c.mtx.Unlock() | ||
|
|
||
|
|
@@ -240,11 +251,13 @@ func (c *GraphCache) UpdatePolicy(policy *models.ChannelEdgePolicy, fromNode, | |
| // policy for node 1. | ||
| case channel.IsNode1 && edge1: | ||
| channel.OutPolicySet = true | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unrelated to this PR, do you know why
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've traced back a bit and it seems it is a left-over from old times when in this function the channel id was retrieved from the out policy object. #3749 introduced the check when it still seemed to make sense. |
||
| channel.InboundFee = inboundFee | ||
|
|
||
| // This is node 2, and it is edge 2, so this is the outgoing | ||
| // policy for node 2. | ||
| case !channel.IsNode1 && !edge1: | ||
| channel.OutPolicySet = true | ||
| channel.InboundFee = inboundFee | ||
|
|
||
| // The other two cases left mean it's the inbound policy for the | ||
| // node. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.