Skip to content

Commit 1498c6e

Browse files
committed
fixup! fixup! Prioritize private channels when relaying payments
1 parent 23381fa commit 1498c6e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

eclair-core/src/main/scala/fr/acinq/eclair/payment/relay/ChannelRelay.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,10 @@ class ChannelRelay private(nodeParams: NodeParams,
388388
.sortWith {
389389
// we always prioritize private channels to avoid exhausting our public channels and disabling them or lowering their htlc_maximum_msat
390390
case (channel1, channel2) if channel1.commitments.announceChannel != channel2.commitments.announceChannel => !channel1.commitments.announceChannel
391-
// otherwise, we use the lowest available capacity to ensure we keep high-capacity channels for big payments
392-
case (channel1, channel2) if channel1.commitments.capacity != channel2.commitments.capacity => channel1.commitments.capacity <= channel2.commitments.capacity
393-
// otherwise, we use the lowest available balance to increase our incoming liquidity
394-
case (channel1, channel2) => channel1.commitments.availableBalanceForSend <= channel2.commitments.availableBalanceForSend
391+
// otherwise, we use the lowest available balance to enusre we keep higher balances for larger payments
392+
case (channel1, channel2) if channel1.commitments.availableBalanceForSend != channel2.commitments.availableBalanceForSend => channel1.commitments.availableBalanceForSend <= channel2.commitments.availableBalanceForSend
393+
// otherwise, we use the lowest available capacity as a last discriminator to have a fully defined sorting algorithm
394+
case (channel1, channel2) => channel1.commitments.capacity <= channel2.commitments.capacity
395395
}.headOption match {
396396
case Some(channel) => Some(channel)
397397
case None =>

0 commit comments

Comments
 (0)