mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-04-11 05:29:11 +02:00
Merge pull request #7315 from sputn1ck/lncli_ordinal_numbers
lncli/sendpayment: more descriptive failure log
This commit is contained in:
commit
d108d7f741
@ -762,9 +762,9 @@ func formatPayment(ctxc context.Context, payment *lnrpc.Payment,
|
||||
state := htlc.Status.String()
|
||||
if htlc.Failure != nil {
|
||||
state = fmt.Sprintf(
|
||||
"%v @ %v",
|
||||
"%v @ %s hop",
|
||||
htlc.Failure.Code,
|
||||
htlc.Failure.FailureSourceIndex,
|
||||
ordinalNumber(htlc.Failure.FailureSourceIndex),
|
||||
)
|
||||
}
|
||||
|
||||
@ -1650,3 +1650,17 @@ var clearCode = fmt.Sprintf("%c[%dA%c[2K", ESC, 1, ESC)
|
||||
func clearLines(count int) {
|
||||
_, _ = fmt.Print(strings.Repeat(clearCode, count))
|
||||
}
|
||||
|
||||
// ordinalNumber returns the ordinal number as a string of a number.
|
||||
func ordinalNumber(num uint32) string {
|
||||
switch num {
|
||||
case 1:
|
||||
return "1st"
|
||||
case 2:
|
||||
return "2nd"
|
||||
case 3:
|
||||
return "3rd"
|
||||
default:
|
||||
return fmt.Sprintf("%dth", num)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user