Skip to content

Commit cbfcd0a

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 9d34100 commit cbfcd0a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ private class OpenChannelInterceptor(peer: ActorRef[Any],
207207
nodeParams.pluginOpenChannelInterceptor match {
208208
case Some(plugin) => queryPlugin(plugin, request, localParams, ChannelConfig.standard, channelType)
209209
case None =>
210+
val addFunding_opt = request.open.fold(_ => None, _.requestFunding_opt).map(requestFunding => LiquidityAds.AddFunding(requestFunding.requestedAmount, nodeParams.willFundRates_opt))
210211
request.open.fold(_ => None, _.requestFunding_opt) match {
211212
case Some(requestFunding) if Features.canUseFeature(request.localFeatures, request.remoteFeatures, Features.OnTheFlyFunding) && localParams.paysCommitTxFees =>
212-
val addFunding = LiquidityAds.AddFunding(requestFunding.requestedAmount, nodeParams.willFundRates_opt)
213-
val accept = SpawnChannelNonInitiator(request.open, ChannelConfig.standard, channelType, Some(addFunding), localParams, request.peerConnection.toClassic)
213+
val accept = SpawnChannelNonInitiator(request.open, ChannelConfig.standard, channelType, addFunding_opt, localParams, request.peerConnection.toClassic)
214214
checkNoExistingChannel(request, accept)
215215
case _ =>
216-
// We don't honor liquidity ads for new channels: node operators should use plugin for that.
217-
peer ! SpawnChannelNonInitiator(request.open, ChannelConfig.standard, channelType, addFunding_opt = None, localParams, request.peerConnection.toClassic)
216+
// TODO: we must change the utxo locking behavior before releasing that change to protect against liquidity griefing.
217+
peer ! SpawnChannelNonInitiator(request.open, ChannelConfig.standard, channelType, addFunding_opt, localParams, request.peerConnection.toClassic)
218218
waitForRequest()
219219
}
220220
}

0 commit comments

Comments
 (0)