File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 23
23
// ErrInvalidUTF8Description is returned if the invoice description is
24
24
// not valid UTF-8.
25
25
ErrInvalidUTF8Description = errors .New ("description is not valid UTF-8" )
26
+
27
+ // ErrLengthNotMultipleOfHopHintLength is returned if the length of the
28
+ // route hint data is not a multiple of the hop hint length.
29
+ ErrLengthNotMultipleOfHopHint = errors .New ("length is not a multiple " +
30
+ "of hop hint length" )
31
+
32
+ // ErrEmptyRouteHint is returned if the route hint field contains no hop
33
+ // data.
34
+ ErrEmptyRouteHint = errors .New ("route hint field contains no hop data" )
26
35
)
27
36
28
37
// DecodeOption is a type that can be used to supply functional options to the
@@ -576,8 +585,12 @@ func parseRouteHint(data []byte) ([]HopHint, error) {
576
585
577
586
// Check that base256Data is a multiple of hopHintLen.
578
587
if len (base256Data )% hopHintLen != 0 {
579
- return nil , fmt .Errorf ("expected length multiple of %d bytes, " +
580
- "got %d" , hopHintLen , len (base256Data ))
588
+ return nil , ErrLengthNotMultipleOfHopHint
589
+ }
590
+
591
+ // Check for empty route hint
592
+ if len (base256Data ) == 0 {
593
+ return nil , ErrEmptyRouteHint
581
594
}
582
595
583
596
var routeHint []HopHint
You can’t perform that action at this time.
0 commit comments