routing: move zero hops check
This commit is contained in:
2 files changed
+5
-7
No files matched your search
@@ -271,6 +271,11 @@ func NewRouteFromHops(amtToSend lnwire.MilliSatoshi, timeLock uint32,
|
||||
func (r *Route) ToSphinxPath() (*sphinx.PaymentPath, error) {
|
||||
var path sphinx.PaymentPath
|
||||
|
||||
// We can only construct a route if there are hops provided.
|
||||
if len(r.Hops) == 0 {
|
||||
return nil, ErrNoRouteHopsProvided
|
||||
}
|
||||
|
||||
// Check maximum route length.
|
||||
if len(r.Hops) > sphinx.NumMaxHops {
|
||||
return nil, ErrMaxRouteHopsExceeded
|
||||
|
||||
Reference in new issue
Block a user