mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
swapserver: add fetchl402 func
This commit is contained in:
parent
6d5d21075f
commit
b14f3defd8
2 changed files with 20 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue