diff --git a/routing/pathfind.go b/routing/pathfind.go index 2bd0174e..923ce9c2 100644 --- a/routing/pathfind.go +++ b/routing/pathfind.go @@ -274,10 +274,10 @@ func newRoute(amtToSend lnwire.MilliSatoshi, pathEdges []*ChannelHop, route.TotalTimeLock += uint32(edge.TimeLockDelta) // If this is the last hop, then for verification purposes, the - // value of the outgoing time-lock should be _exactly_ the time - // lock delta specified within the routing information. + // value of the outgoing time-lock should be _exactly_ the + // absolute time out they'd expect in the HTLC. if i == len(pathEdges)-1 { - nextHop.OutgoingTimeLock = uint32(edge.TimeLockDelta) + nextHop.OutgoingTimeLock = currentHeight + uint32(edge.TimeLockDelta) } else { // Otherwise, the value of the outgoing time-lock will // be the value of the time-lock for the _outgoing_ diff --git a/routing/pathfind_test.go b/routing/pathfind_test.go index 5b26813b..5272ef3a 100644 --- a/routing/pathfind_test.go +++ b/routing/pathfind_test.go @@ -382,7 +382,7 @@ func TestBasicGraphPathFinding(t *testing.T) { t.Fatalf("expected outgoing time-lock of %v, instead have %v", 1, route.Hops[0].OutgoingTimeLock) } - if route.Hops[1].OutgoingTimeLock != 1 { + if route.Hops[1].OutgoingTimeLock != 101 { t.Fatalf("outgoing time-lock for final hop is incorrect: "+ "expected %v, got %v", 1, route.Hops[1].OutgoingTimeLock) } diff --git a/routing/router.go b/routing/router.go index dda85b64..f19af837 100644 --- a/routing/router.go +++ b/routing/router.go @@ -1002,6 +1002,7 @@ func (r *ChannelRouter) SendPayment(payment *LightningPayment) ([32]byte, *Route // payment amount. If no such routes can be found then an error will be // returned. if !ok { + // TODO(roasbeef): put cache handling into FindRoutes freshRoutes, err := r.FindRoutes(payment.Target, payment.Amount) if err != nil { return preImage, nil, err