Skip to content

Commit e72d998

Browse files
committed
loopout: show expiry range in terms
1 parent 05fd1da commit e72d998

File tree

7 files changed

+152
-103
lines changed

7 files changed

+152
-103
lines changed

cmd/loop/terms.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ func terms(ctx *cli.Context) error {
3939
loopOutTerms.MinSwapAmount,
4040
loopOutTerms.MaxSwapAmount,
4141
)
42+
fmt.Printf("Cltv delta: %d - %d\n",
43+
loopOutTerms.MinCltvDelta, loopOutTerms.MaxCltvDelta,
44+
)
4245
}
4346

4447
fmt.Println()

interface.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ type LoopOutTerms struct {
124124
// MaxSwapAmount is the maximum amount that the server accepts for a
125125
// swap.
126126
MaxSwapAmount btcutil.Amount
127+
128+
// MinCltvDelta is the minimum expiry delta for loop out swaps.
129+
MinCltvDelta int32
130+
131+
// MaxCltvDelta is the maximum expiry delta for loop out swaps.
132+
MaxCltvDelta int32
127133
}
128134

129135
// LoopOutQuote contains estimates for the fees making up the total swap cost

loopd/swapclient_server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ func (s *swapClientServer) LoopOutTerms(ctx context.Context,
341341
return &looprpc.OutTermsResponse{
342342
MinSwapAmount: int64(terms.MinSwapAmount),
343343
MaxSwapAmount: int64(terms.MaxSwapAmount),
344+
MinCltvDelta: terms.MinCltvDelta,
345+
MaxCltvDelta: terms.MaxCltvDelta,
344346
}, nil
345347
}
346348

looprpc/client.pb.go

Lines changed: 123 additions & 103 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

looprpc/client.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,12 @@ message OutTermsResponse {
447447
Maximum swap amount (sat)
448448
*/
449449
int64 max_swap_amount = 6;
450+
451+
// The minimally accepted cltv delta of the on-chain htlc.
452+
int32 min_cltv_delta = 8;
453+
454+
// The maximally accepted cltv delta of the on-chain htlc.
455+
int32 max_cltv_delta = 9;
450456
}
451457

452458
message QuoteRequest {

looprpc/client.swagger.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,16 @@
548548
"type": "string",
549549
"format": "int64",
550550
"title": "*\nMaximum swap amount (sat)"
551+
},
552+
"min_cltv_delta": {
553+
"type": "integer",
554+
"format": "int32",
555+
"description": "The minimally accepted cltv delta of the on-chain htlc."
556+
},
557+
"max_cltv_delta": {
558+
"type": "integer",
559+
"format": "int32",
560+
"description": "The maximally accepted cltv delta of the on-chain htlc."
551561
}
552562
}
553563
},

swap_server_client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ func (s *grpcSwapServerClient) GetLoopOutTerms(ctx context.Context) (
140140
return &LoopOutTerms{
141141
MinSwapAmount: btcutil.Amount(terms.MinSwapAmount),
142142
MaxSwapAmount: btcutil.Amount(terms.MaxSwapAmount),
143+
MinCltvDelta: terms.MinCltvDelta,
144+
MaxCltvDelta: terms.MaxCltvDelta,
143145
}, nil
144146
}
145147

0 commit comments

Comments
 (0)