lnrpc/routerrpc: use vertex constructor
This commit is contained in:
parent
a332990d2c
commit
6ee2c04190
@ -89,15 +89,7 @@ func (r *RouterBackend) QueryRoutes(ctx context.Context,
|
|||||||
return route.Vertex{}, err
|
return route.Vertex{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(pubKeyBytes) != 33 {
|
return route.NewVertexFromBytes(pubKeyBytes)
|
||||||
return route.Vertex{},
|
|
||||||
errors.New("invalid key length")
|
|
||||||
}
|
|
||||||
|
|
||||||
var v route.Vertex
|
|
||||||
copy(v[:], pubKeyBytes)
|
|
||||||
|
|
||||||
return v, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the hex-encoded source and target public keys into full public
|
// Parse the hex-encoded source and target public keys into full public
|
||||||
@ -134,11 +126,10 @@ func (r *RouterBackend) QueryRoutes(ctx context.Context,
|
|||||||
|
|
||||||
ignoredNodes := make(map[route.Vertex]struct{})
|
ignoredNodes := make(map[route.Vertex]struct{})
|
||||||
for _, ignorePubKey := range in.IgnoredNodes {
|
for _, ignorePubKey := range in.IgnoredNodes {
|
||||||
if len(ignorePubKey) != 33 {
|
ignoreVertex, err := route.NewVertexFromBytes(ignorePubKey)
|
||||||
return nil, fmt.Errorf("invalid ignore node pubkey")
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
var ignoreVertex route.Vertex
|
|
||||||
copy(ignoreVertex[:], ignorePubKey)
|
|
||||||
ignoredNodes[ignoreVertex] = struct{}{}
|
ignoredNodes[ignoreVertex] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,12 +475,11 @@ func (r *RouterBackend) extractIntentFromSendRequest(
|
|||||||
// from the other fields.
|
// from the other fields.
|
||||||
|
|
||||||
// Payment destination.
|
// Payment destination.
|
||||||
if len(rpcPayReq.Dest) != 33 {
|
target, err := route.NewVertexFromBytes(rpcPayReq.Dest)
|
||||||
return nil, errors.New("invalid key length")
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
pubBytes := rpcPayReq.Dest
|
payIntent.Target = target
|
||||||
copy(payIntent.Target[:], pubBytes)
|
|
||||||
|
|
||||||
// Final payment CLTV delta.
|
// Final payment CLTV delta.
|
||||||
if rpcPayReq.FinalCltvDelta != 0 {
|
if rpcPayReq.FinalCltvDelta != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user