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: use correct fees by searching backwards #1321

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion routing/heap.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package routing

import "github.com/lightningnetwork/lnd/channeldb"
import (
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/lnwire"
)

// nodeWithDist is a helper struct that couples the distance from the current
// source to a node with a pointer to the node itself.
Expand All @@ -12,6 +15,14 @@ type nodeWithDist struct {
// node is the vertex itself. This pointer can be used to explore all
// the outgoing edges (channels) emanating from a node.
node *channeldb.LightningNode

// amountToReceive is the amount that should be received by this node.
// Either as final payment to the final node or as an intermediate
// amount that includes also the fees for subsequent hops.
amountToReceive lnwire.MilliSatoshi

// fee is the fee that this node is charging for forwarding.
fee lnwire.MilliSatoshi
}

// distanceHeap is a min-distance heap that's used within our path finding
Expand Down
2 changes: 1 addition & 1 deletion routing/missioncontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func (p *paymentSession) RequestRoute(payment *LightningPayment,
path, err := findPath(
nil, p.mc.graph, p.additionalEdges, p.mc.selfNode,
payment.Target, pruneView.vertexes, pruneView.edges,
payment.Amount, p.bandwidthHints,
payment.Amount, payment.FeeLimit, p.bandwidthHints,
)
if err != nil {
return nil, err
Expand Down
Loading