Skip to content

Commit d5c9a66

Browse files
committed
swap_server_client: call server with SwapPublicationDeadline set
1 parent b2d1d99 commit d5c9a66

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,9 @@ func (s *Client) LoopOutQuote(ctx context.Context,
369369
return nil, ErrSwapAmountTooHigh
370370
}
371371

372-
quote, err := s.Server.GetLoopOutQuote(ctx, request.Amount)
372+
quote, err := s.Server.GetLoopOutQuote(
373+
ctx, request.Amount, request.SwapPublicationDeadline,
374+
)
373375
if err != nil {
374376
return nil, err
375377
}

server_mock_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ func (s *serverMock) GetLoopOutTerms(ctx context.Context) (
9494
}, nil
9595
}
9696

97-
func (s *serverMock) GetLoopOutQuote(ctx context.Context, amt btcutil.Amount) (
98-
*LoopOutQuote, error) {
97+
func (s *serverMock) GetLoopOutQuote(ctx context.Context, amt btcutil.Amount,
98+
_ time.Time) (*LoopOutQuote, error) {
9999

100100
dest := [33]byte{1, 2, 3}
101101

swap_server_client.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ type swapServerClient interface {
2222
GetLoopOutTerms(ctx context.Context) (
2323
*LoopOutTerms, error)
2424

25-
GetLoopOutQuote(ctx context.Context, amt btcutil.Amount) (
25+
GetLoopOutQuote(ctx context.Context, amt btcutil.Amount,
26+
swapPublicationDeadline time.Time) (
2627
*LoopOutQuote, error)
2728

2829
GetLoopInTerms(ctx context.Context) (
@@ -93,13 +94,15 @@ func (s *grpcSwapServerClient) GetLoopOutTerms(ctx context.Context) (
9394
}
9495

9596
func (s *grpcSwapServerClient) GetLoopOutQuote(ctx context.Context,
96-
amt btcutil.Amount) (*LoopOutQuote, error) {
97+
amt btcutil.Amount, swapPublicationDeadline time.Time) (
98+
*LoopOutQuote, error) {
9799

98100
rpcCtx, rpcCancel := context.WithTimeout(ctx, globalCallTimeout)
99101
defer rpcCancel()
100102
quoteResp, err := s.server.LoopOutQuote(rpcCtx,
101103
&looprpc.ServerLoopOutQuoteRequest{
102-
Amt: uint64(amt),
104+
Amt: uint64(amt),
105+
SwapPublicationDeadline: swapPublicationDeadline.Unix(),
103106
},
104107
)
105108
if err != nil {

0 commit comments

Comments
 (0)