swapserver: add fetchl402 func

pull/672/head
sputn1ck 5 months ago
parent 6d5d21075f
commit b14f3defd8
No known key found for this signature in database
GPG Key ID: 671103D881A5F0E4

@ -273,3 +273,7 @@ func (s *serverMock) PushKey(_ context.Context, _ loopdb.ProtocolVersion,
return nil
}
func (s *serverMock) FetchL402(_ context.Context) error {
return nil
}

@ -135,6 +135,10 @@ type swapServerClient interface {
PushKey(ctx context.Context,
protocolVersion loopdb.ProtocolVersion, swapHash lntypes.Hash,
clientInternalPrivateKey [32]byte) error
// FetchL402 is a helper function that tries to fetch an l402 token
// from the server.
FetchL402(ctx context.Context) error
}
type grpcSwapServerClient struct {
@ -790,6 +794,18 @@ func (s *grpcSwapServerClient) PushKey(ctx context.Context,
return err
}
// FetchL402 is a helper function that tries to fetch an l402 token from the
// server.
func (s *grpcSwapServerClient) FetchL402(ctx context.Context) error {
req := &looprpc.FetchL402Request{}
rpcCtx, rpcCancel := context.WithTimeout(ctx, globalCallTimeout)
defer rpcCancel()
_, err := s.server.FetchL402(rpcCtx, req)
return err
}
func rpcRouteCancel(details *outCancelDetails) (
*looprpc.CancelLoopOutSwapRequest_RouteCancel, error) {

Loading…
Cancel
Save