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
8 changes: 7 additions & 1 deletion cmd/loop/quote.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,13 @@ func printQuoteInResp(req *looprpc.QuoteRequest,
totalFee := resp.HtlcPublishFeeSat + resp.SwapFeeSat

if req.DepositOutpoints != nil {
fmt.Printf(satAmtFmt, "Previously deposited on-chain:", req.Amt)
if req.Amt == 0 {
fmt.Printf(satAmtFmt, "Previously deposited "+
"on-chain:", resp.QuotedAmt)
} else {
fmt.Printf(satAmtFmt, "Previously deposited "+
"on-chain:", req.Amt)
}
Comment on lines +236 to +242

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block can be simplified to avoid repeating the fmt.Printf call and the string literal. By determining the amount to print first and then calling fmt.Printf once, the code becomes more concise and easier to maintain.

		amt := req.Amt
		if amt == 0 {
			amt = resp.QuotedAmt
		}
		fmt.Printf(satAmtFmt, "Previously deposited on-chain:", amt)

} else {
fmt.Printf(satAmtFmt, "Send on-chain:", req.Amt)
}
Expand Down
1 change: 1 addition & 0 deletions loopd/swapclient_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,7 @@ func (s *swapClientServer) GetLoopInQuote(ctx context.Context,
HtlcPublishFeeSat: int64(quote.MinerFee),
SwapFeeSat: int64(quote.SwapFee),
ConfTarget: htlcConfTarget,
QuotedAmt: int64(selectedAmount),
}, nil
}

Expand Down
Loading