Skip to content

Commit 1bd7319

Browse files
committed
cmd: display correct Receive off-chain amount
1 parent 3323bea commit 1bd7319

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
@@ -231,23 +231,22 @@ func printQuoteInResp(req *looprpc.QuoteRequest,
231231
resp *looprpc.InQuoteResponse, verbose bool) {
232232

233233
totalFee := resp.HtlcPublishFeeSat + resp.SwapFeeSat
234+
amt := req.Amt
235+
if amt == 0 {
236+
amt = resp.QuotedAmt
237+
}
234238

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

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

0 commit comments

Comments
 (0)