Improve error message when payment is rejected

This commit is contained in:
Dominique Padiou 2024-03-22 17:49:26 +01:00
parent d36ad92ed5
commit cc0d042927
No known key found for this signature in database
GPG Key ID: 574C8C6A1673E987

View File

@ -300,7 +300,23 @@ class Phoenixd : CliktCommand() {
nodeParams.nodeEvents nodeParams.nodeEvents
.filterIsInstance<LiquidityEvents.Decision.Rejected>() .filterIsInstance<LiquidityEvents.Decision.Rejected>()
.collect { .collect {
consoleLog(yellow("lightning payment rejected: amount=${it.amount.truncateToSatoshi()} fee=${it.fee.truncateToSatoshi()} maxFee=${liquidityPolicy.maxAbsoluteFee}")) when (val reason = it.reason) {
is LiquidityEvents.Decision.Rejected.Reason.OverMaxCredit -> {
consoleLog(yellow("lightning payment rejected (amount=${it.amount.truncateToSatoshi()}): over max fee credit=${reason.maxAllowedCredit}"))
}
is LiquidityEvents.Decision.Rejected.Reason.TooExpensive.OverAbsoluteFee -> {
consoleLog(yellow("lightning payment rejected (amount=${it.amount.truncateToSatoshi()}): fee=${it.fee.truncateToSatoshi()} > maxFee=${reason.maxAbsoluteFee}"))
}
is LiquidityEvents.Decision.Rejected.Reason.TooExpensive.OverRelativeFee -> {
consoleLog(yellow("lightning payment rejected (amount=${it.amount.truncateToSatoshi()}): fee=${it.fee.truncateToSatoshi()} more than ${reason.maxRelativeFeeBasisPoints.toDouble() / 100}% of amount"))
}
LiquidityEvents.Decision.Rejected.Reason.ChannelInitializing -> {
consoleLog(yellow("channels are initializing"))
}
LiquidityEvents.Decision.Rejected.Reason.PolicySetToDisabled -> {
consoleLog(yellow("automated liquidity is disabled"))
}
}
} }
} }
launch { launch {