Skip to content

Commit

Permalink
Add maxExcess_opt to ChannelParams in NodeParams
Browse files Browse the repository at this point in the history
This will be used by non-initiators when funding dual funded channels and splicing
  • Loading branch information
remyers committed Sep 4, 2024
1 parent 4a03134 commit 8cc2e4a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions eclair-core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ eclair {

min-time-between-updates = 1 hour // minimum time between channel updates because the balance changed
}

// if > 0, excess channel funding up to this amount will be added to the amount contributed when funding
// dual-funded channels or splices. This is useful to avoid paying fees to add a small change output.
max-excess = 0
}

balance-check-interval = 1 hour
Expand Down
5 changes: 4 additions & 1 deletion eclair-core/src/main/scala/fr/acinq/eclair/NodeParams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ object NodeParams extends Logging {
val maxNoChannels = config.getInt("peer-connection.max-no-channels")
require(maxNoChannels > 0, "peer-connection.max-no-channels must be > 0")

val maxExcess_opt = if (config.getInt("channel.max-excess") > 0) Some(Satoshi(config.getInt("channel.max-excess"))) else None

NodeParams(
nodeKeyManager = nodeKeyManager,
channelKeyManager = channelKeyManager,
Expand Down Expand Up @@ -524,7 +526,8 @@ object NodeParams extends Logging {
quiescenceTimeout = FiniteDuration(config.getDuration("channel.quiescence-timeout").getSeconds, TimeUnit.SECONDS),
balanceThresholds = config.getConfigList("channel.channel-update.balance-thresholds").asScala.map(conf => BalanceThreshold(Satoshi(conf.getLong("available-sat")), Satoshi(conf.getLong("max-htlc-sat")))).toSeq,
minTimeBetweenUpdates = FiniteDuration(config.getDuration("channel.channel-update.min-time-between-updates").getSeconds, TimeUnit.SECONDS),
acceptIncomingStaticRemoteKeyChannels = config.getBoolean("channel.accept-incoming-static-remote-key-channels")
acceptIncomingStaticRemoteKeyChannels = config.getBoolean("channel.accept-incoming-static-remote-key-channels"),
maxExcess_opt = maxExcess_opt,
),
onChainFeeConf = OnChainFeeConf(
feeTargets = feeTargets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ object Channel {
quiescenceTimeout: FiniteDuration,
balanceThresholds: Seq[BalanceThreshold],
minTimeBetweenUpdates: FiniteDuration,
acceptIncomingStaticRemoteKeyChannels: Boolean) {
acceptIncomingStaticRemoteKeyChannels: Boolean,
maxExcess_opt: Option[Satoshi]) {
require(0 <= maxHtlcValueInFlightPercent && maxHtlcValueInFlightPercent <= 100, "max-htlc-value-in-flight-percent must be between 0 and 100")
require(balanceThresholds.sortBy(_.available) == balanceThresholds, "channel-update.balance-thresholds must be sorted by available-sat")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ object TestConstants {
quiescenceTimeout = 2 minutes,
balanceThresholds = Nil,
minTimeBetweenUpdates = 0 hours,
acceptIncomingStaticRemoteKeyChannels = false
acceptIncomingStaticRemoteKeyChannels = false,
maxExcess_opt = None
),
onChainFeeConf = OnChainFeeConf(
feeTargets = FeeTargets(funding = ConfirmationPriority.Medium, closing = ConfirmationPriority.Medium),
Expand Down Expand Up @@ -316,7 +317,8 @@ object TestConstants {
quiescenceTimeout = 2 minutes,
balanceThresholds = Nil,
minTimeBetweenUpdates = 0 hour,
acceptIncomingStaticRemoteKeyChannels = false
acceptIncomingStaticRemoteKeyChannels = false,
maxExcess_opt = None
),
onChainFeeConf = OnChainFeeConf(
feeTargets = FeeTargets(funding = ConfirmationPriority.Medium, closing = ConfirmationPriority.Medium),
Expand Down

0 comments on commit 8cc2e4a

Please sign in to comment.