Skip to content

Commit e70d347

Browse files
committed
cmd: display correct Receive off-chain amount
1 parent 113f716 commit e70d347

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

cmd/loop/quote.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,23 +229,22 @@ func printQuoteInResp(req *looprpc.QuoteRequest,
229229
resp *looprpc.InQuoteResponse, verbose bool) {
230230

231231
totalFee := resp.HtlcPublishFeeSat + resp.SwapFeeSat
232+
amt := req.Amt
233+
if amt == 0 {
234+
amt = resp.QuotedAmt
235+
}
232236

233237
if req.DepositOutpoints != nil {
234-
if req.Amt == 0 {
235-
fmt.Printf(satAmtFmt, "Previously deposited "+
236-
"on-chain:", resp.QuotedAmt)
237-
} else {
238-
fmt.Printf(satAmtFmt, "Previously deposited "+
239-
"on-chain:", req.Amt)
240-
}
238+
fmt.Printf(satAmtFmt, "Previously deposited on-chain:",
239+
amt)
241240
} else {
242-
fmt.Printf(satAmtFmt, "Send on-chain:", req.Amt)
241+
fmt.Printf(satAmtFmt, "Send on-chain:", amt)
243242
}
244-
fmt.Printf(satAmtFmt, "Receive off-chain:", req.Amt-totalFee)
243+
fmt.Printf(satAmtFmt, "Receive off-chain:", amt-totalFee)
245244

246245
switch {
247246
case req.ExternalHtlc && !verbose:
248-
// If it's external then we don't know the miner fee hence the
247+
// If it's external, then we don't know the miner fee hence the
249248
// total cost.
250249
fmt.Printf(satAmtFmt, "Loop service fee:", resp.SwapFeeSat)
251250

0 commit comments

Comments
 (0)