Skip to content

Commit 0cff92d

Browse files
committed
looprpc+cmd: deprecate dynamic terms
We move destination and cltv to QuoteResponse, and deprecate the non-static fields. Terms will now only show max/min swap sizes.
1 parent 5fd51c0 commit 0cff92d

File tree

5 files changed

+114
-184
lines changed

5 files changed

+114
-184
lines changed

cmd/loop/terms.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
"github.com/btcsuite/btcutil"
1010
"github.com/lightninglabs/loop/looprpc"
11-
"github.com/lightninglabs/loop/swap"
1211
)
1312

1413
var termsCommand = cli.Command{
@@ -29,13 +28,6 @@ func terms(ctx *cli.Context) error {
2928
btcutil.Amount(terms.MinSwapAmount),
3029
btcutil.Amount(terms.MaxSwapAmount),
3130
)
32-
fmt.Printf("Fee: %d + %.4f %% (%d prepaid)\n",
33-
btcutil.Amount(terms.SwapFeeBase),
34-
swap.FeeRateAsPercentage(terms.SwapFeeRate),
35-
btcutil.Amount(terms.PrepayAmt),
36-
)
37-
38-
fmt.Printf("Cltv delta: %v blocks\n", terms.CltvDelta)
3931
}
4032

4133
fmt.Println("Loop Out")

cmd/loopd/swapclient_server.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,6 @@ func (s *swapClientServer) LoopOutTerms(ctx context.Context,
244244
return &looprpc.TermsResponse{
245245
MinSwapAmount: int64(terms.MinSwapAmount),
246246
MaxSwapAmount: int64(terms.MaxSwapAmount),
247-
PrepayAmt: int64(terms.PrepayAmt),
248-
SwapFeeBase: int64(terms.SwapFeeBase),
249-
SwapFeeRate: int64(terms.SwapFeeRate),
250-
CltvDelta: int32(terms.CltvDelta),
251247
}, nil
252248
}
253249

@@ -269,6 +265,7 @@ func (s *swapClientServer) LoopOutQuote(ctx context.Context,
269265
if err != nil {
270266
return nil, err
271267
}
268+
272269
return &looprpc.QuoteResponse{
273270
MinerFee: int64(quote.MinerFee),
274271
PrepayAmt: int64(quote.PrepayAmount),
@@ -291,9 +288,6 @@ func (s *swapClientServer) GetLoopInTerms(ctx context.Context, req *looprpc.Term
291288
return &looprpc.TermsResponse{
292289
MinSwapAmount: int64(terms.MinSwapAmount),
293290
MaxSwapAmount: int64(terms.MaxSwapAmount),
294-
SwapFeeBase: int64(terms.SwapFeeBase),
295-
SwapFeeRate: int64(terms.SwapFeeRate),
296-
CltvDelta: int32(terms.CltvDelta),
297291
}, nil
298292
}
299293

looprpc/client.pb.go

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

looprpc/client.proto

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -305,26 +305,8 @@ message TermsRequest {
305305
}
306306

307307
message TermsResponse {
308-
/**
309-
The node pubkey where the swap payment needs to be paid
310-
to. This can be used to test connectivity before initiating the swap.
311-
*/
312-
string swap_payment_dest = 1;
313308

314-
/**
315-
The base fee for a swap (sat)
316-
*/
317-
int64 swap_fee_base = 2;
318-
319-
/**
320-
The fee rate for a swap (parts per million)
321-
*/
322-
int64 swap_fee_rate = 3;
323-
324-
/**
325-
Required prepay amount
326-
*/
327-
int64 prepay_amt = 4;
309+
reserved 1,2,3,4,7;
328310

329311
/**
330312
Minimum swap amount (sat)
@@ -335,11 +317,6 @@ message TermsResponse {
335317
Maximum swap amount (sat)
336318
*/
337319
int64 max_swap_amount = 6;
338-
339-
/**
340-
On-chain cltv expiry delta
341-
*/
342-
int32 cltv_delta = 7;
343320
}
344321

345322
message QuoteRequest {
@@ -378,4 +355,15 @@ message QuoteResponse {
378355
An estimate of the on-chain fee that needs to be paid to sweep the HTLC.
379356
*/
380357
int64 miner_fee = 3;
358+
359+
/**
360+
The node pubkey where the swap payment needs to be paid
361+
to. This can be used to test connectivity before initiating the swap.
362+
*/
363+
bytes swap_payment_dest = 4;
364+
365+
/**
366+
On-chain cltv expiry delta
367+
*/
368+
int32 cltv_delta = 5;
381369
}

0 commit comments

Comments
 (0)