Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/loop/instantout.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ func instantOut(ctx *cli.Context) error {
// fee-rates.
quote, err := client.InstantOutQuote(
context.Background(), &looprpc.InstantOutQuoteRequest{
Amt: selectedAmt,
NumReservations: int32(len(selectedReservations)),
Amt: selectedAmt,
ReservationIds: selectedReservations,
},
)
if err != nil {
Expand Down
9 changes: 5 additions & 4 deletions instantout/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ type Quote struct {

// GetInstantOutQuote returns a quote for an instant out.
func (m *Manager) GetInstantOutQuote(ctx context.Context,
amt btcutil.Amount, numReservations int) (Quote, error) {
amt btcutil.Amount, reservationIDs [][]byte) (Quote, error) {

if numReservations <= 0 {
if len(reservationIDs) == 0 {
return Quote{}, fmt.Errorf("no reservations selected")
}

Expand All @@ -231,7 +231,8 @@ func (m *Manager) GetInstantOutQuote(ctx context.Context,
// Get the service fee.
quoteRes, err := m.cfg.InstantOutClient.GetInstantOutQuote(
ctx, &swapserverrpc.GetInstantOutQuoteRequest{
Amount: uint64(amt),
Amount: uint64(amt),
ReservationIds: reservationIDs,
},
)
if err != nil {
Expand All @@ -247,7 +248,7 @@ func (m *Manager) GetInstantOutQuote(ctx context.Context,

// The on chain chainFee is the chainFee rate times the estimated
// sweepless sweep transaction size.
chainFee := feeRate.FeeForWeight(sweeplessSweepWeight(numReservations))
chainFee := feeRate.FeeForWeight(sweeplessSweepWeight(len(reservationIDs)))

return Quote{
ServiceFee: btcutil.Amount(quoteRes.SwapFee),
Expand Down
2 changes: 1 addition & 1 deletion loopd/swapclient_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ func (s *swapClientServer) InstantOutQuote(ctx context.Context,
*looprpc.InstantOutQuoteResponse, error) {

quote, err := s.instantOutManager.GetInstantOutQuote(
ctx, btcutil.Amount(req.Amt), int(req.NumReservations),
ctx, btcutil.Amount(req.Amt), req.ReservationIds,
)
if err != nil {
return nil, err
Expand Down
1,016 changes: 516 additions & 500 deletions looprpc/client.pb.go

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion looprpc/client.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1532,9 +1532,15 @@ message InstantOutQuoteRequest {
uint64 amt = 1;

/*
Deprecated: use 'reservation_ids' instead.
The amount of reservations to use for the swap.
*/
int32 num_reservations = 2;
int32 num_reservations = 2 [deprecated = true];

/*
The reservations to use for the swap.
*/
repeated bytes reservation_ids = 3;
}

message InstantOutQuoteResponse {
Expand Down
117 changes: 64 additions & 53 deletions swapserverrpc/instantout.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions swapserverrpc/instantout.proto
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ message CancelInstantSwapResponse {
message GetInstantOutQuoteRequest {
// The amount to swap in satoshis.
uint64 amount = 1;

// The reservation ids that will be used for the swap.
repeated bytes reservation_ids = 2;
}

message GetInstantOutQuoteResponse {
Expand Down