diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/channel/Commitments.scala b/eclair-core/src/main/scala/fr/acinq/eclair/channel/Commitments.scala index 0ad044adc0..d2df2ec0eb 100644 --- a/eclair-core/src/main/scala/fr/acinq/eclair/channel/Commitments.scala +++ b/eclair-core/src/main/scala/fr/acinq/eclair/channel/Commitments.scala @@ -141,8 +141,8 @@ object ChannelParams { // small amount: not scaled defaultMinDepth } else { - val blockReward = 6.25 // this is true as of ~May 2020, but will be too large after 2024 - val scalingFactor = 15 + val blockReward = 3.125 // this will be too large after the halving in 2028 + val scalingFactor = 10 val blocksToReachFunding = (((scalingFactor * amount.toBtc.toDouble) / blockReward).ceil + 1).toInt defaultMinDepth.max(blocksToReachFunding) } diff --git a/eclair-core/src/test/scala/fr/acinq/eclair/channel/HelpersSpec.scala b/eclair-core/src/test/scala/fr/acinq/eclair/channel/HelpersSpec.scala index 52b3d7bf4d..bd057a4757 100644 --- a/eclair-core/src/test/scala/fr/acinq/eclair/channel/HelpersSpec.scala +++ b/eclair-core/src/test/scala/fr/acinq/eclair/channel/HelpersSpec.scala @@ -39,13 +39,13 @@ class HelpersSpec extends TestKitBaseClass with AnyFunSuiteLike with ChannelStat implicit val log: akka.event.LoggingAdapter = akka.event.NoLogging test("scale funding tx min depth according to funding amount") { - assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(1)) == 4) - assert(ChannelParams.minDepthScaled(defaultMinDepth = 6, Btc(1)) == 6) // 4 conf would be enough but we use min-depth=6 - assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(6.25)) == 16) // we use scaling_factor=15 and a fixed block reward of 6.25BTC - assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(12.5)) == 31) - assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(12.6)) == 32) - assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(30)) == 73) - assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(50)) == 121) + assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(1)) == 5) + assert(ChannelParams.minDepthScaled(defaultMinDepth = 6, Btc(1)) == 6) // 5 conf would be enough but we use min-depth=6 + assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(3.125)) == 11) // we use scaling_factor=10 and a fixed block reward of 3.125BTC + assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(6.25)) == 21) + assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(10)) == 33) + assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(25)) == 81) + assert(ChannelParams.minDepthScaled(defaultMinDepth = 3, Btc(50)) == 161) } test("compute refresh delay") {