routing: hop-payload for last hop should be the absolute timeout, not delta

This commit fixes an oversight in the path finding code when converting
a path into a route. Currently, for the last hop, we’d emplace the
expiry delta of the last hop within the per-hop payload. This was left
over from a prior version of the specification.

To fix this, we’ll now emplace the _absolute_ final HTLC expiry with
the payload, such that, the final hop that verify that the HTLC has not
been tampered with in flight.
This commit is contained in:
Olaoluwa Osuntokun committed 2017-09-12 21:27:47 +02:00
1 parent f32a7a28ab
commit b07e7fb7cc
3 files changed
+5 -4

No files matched your search

+3 -3
View File
@@ -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_