Skip to content

Commit f0e3e81

Browse files
committed
Accept incoming liquidity requests
If liquidity ads is active (the node operator has set some funding rates), we accept selling liquidity to whoever wants to purchase it. This behavior can be customized by a dedicated liquidity plugin. This is a work-in-progress: to protect against liquidity griefing, we must ensure that utxos are never locked when funding transactions.
1 parent e3253f3 commit f0e3e81

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

eclair-core/src/main/scala/fr/acinq/eclair/io/OpenChannelInterceptor.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ private class OpenChannelInterceptor(peer: ActorRef[Any],
187187
nodeParams.pluginOpenChannelInterceptor match {
188188
case Some(plugin) => queryPlugin(plugin, request, localParams, ChannelConfig.standard, channelType)
189189
case None =>
190+
val addFunding_opt = request.open.fold(_ => None, _.requestFunding_opt).map(requestFunding => LiquidityAds.AddFunding(requestFunding.requestedAmount, nodeParams.liquidityAdsConfig.rates_opt))
190191
request.open.fold(_ => None, _.requestFunding_opt) match {
191-
case Some(requestFunding) if Features.canUseFeature(request.localFeatures, request.remoteFeatures, Features.OnTheFlyFunding) && localParams.paysCommitTxFees =>
192-
val addFunding = LiquidityAds.AddFunding(requestFunding.requestedAmount, nodeParams.liquidityAdsConfig.rates_opt)
193-
val accept = SpawnChannelNonInitiator(request.open, ChannelConfig.standard, channelType, Some(addFunding), localParams, request.peerConnection.toClassic)
192+
case Some(_) if Features.canUseFeature(request.localFeatures, request.remoteFeatures, Features.OnTheFlyFunding) && localParams.paysCommitTxFees =>
193+
val accept = SpawnChannelNonInitiator(request.open, ChannelConfig.standard, channelType, addFunding_opt, localParams, request.peerConnection.toClassic)
194194
checkNoExistingChannel(request, accept)
195195
case _ =>
196-
// We don't honor liquidity ads for new channels: node operators should use plugin for that.
197-
peer ! SpawnChannelNonInitiator(request.open, ChannelConfig.standard, channelType, addFunding_opt = None, localParams, request.peerConnection.toClassic)
196+
// TODO: we must change the utxo locking behavior before releasing that change to protect against liquidity griefing.
197+
peer ! SpawnChannelNonInitiator(request.open, ChannelConfig.standard, channelType, addFunding_opt, localParams, request.peerConnection.toClassic)
198198
waitForRequest()
199199
}
200200
}

0 commit comments

Comments
 (0)