routing/route: define route.ReceiverAmt() method

This commit is contained in:
Johan T. Halseth committed 2020-04-02 10:24:34 +02:00
1 parent 4485e8261f
commit 79227bab3a
3 files changed
+31 -5

No files matched your search

+10 -1
View File
@@ -308,7 +308,16 @@ func (r *Route) TotalFees() lnwire.MilliSatoshi {
return 0
}
return r.TotalAmount - r.Hops[len(r.Hops)-1].AmtToForward
return r.TotalAmount - r.ReceiverAmt()
}
// ReceiverAmt is the amount received by the final hop of this route.
func (r *Route) ReceiverAmt() lnwire.MilliSatoshi {
if len(r.Hops) == 0 {
return 0
}
return r.Hops[len(r.Hops)-1].AmtToForward
}
// NewRouteFromHops creates a new Route structure from the minimally required