What changed, and why it matters
This commit only changes test code. It fixes flaky balance fuzz tests in Eclair by giving simulated channels more starting money so they can afford higher transaction fees under anchor outputs. There is no change to production code, no real-world security fix, and no vulnerability being patched.
No security action required. Treat as a routine test-maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies CommitmentsSpec.scala, a unit test file. It increases the initial toLocal/toRemote balance multiplier from 10 to 15 times the max pending HTLC amount and replaces the ScalaTest ignore/skip helper with a silent comment. The goal is to avoid test failures caused by anchor outputs increasing commitment transaction weight, which can exhaust the remote balance for fees at high feerates. No production channel logic is altered.
Changed components
eclair-core/src/test/scala/fr/acinq/eclair/channel/CommitmentsSpec.scalaInspect captured patch +12 / −12
diff --git a/eclair-core/src/test/scala/fr/acinq/eclair/channel/CommitmentsSpec.scala b/eclair-core/src/test/scala/fr/acinq/eclair/channel/CommitmentsSpec.scala
index 6b03a0a..c314d28 100644
--- a/eclair-core/src/test/scala/fr/acinq/eclair/channel/CommitmentsSpec.scala
+++ b/eclair-core/src/test/scala/fr/acinq/eclair/channel/CommitmentsSpec.scala
@@ -415,17 +415,17 @@ class CommitmentsSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with
}
test("should always be able to send availableForSend", Tag("fuzzy")) { f =>
- val maxPendingHtlcAmount = 1000000.msat
+ val maxPendingHtlcAmount = 1_000_000.msat
case class FuzzTest(isInitiator: Boolean, pendingHtlcs: Int, feeRatePerKw: FeeratePerKw, dustLimit: Satoshi, toLocal: MilliSatoshi, toRemote: MilliSatoshi)
for (_ <- 1 to 100) {
val t = FuzzTest(
isInitiator = Random.nextInt(2) == 0,
pendingHtlcs = Random.nextInt(10),
- feeRatePerKw = FeeratePerKw(Random.nextInt(10000).max(1).sat),
+ feeRatePerKw = FeeratePerKw(Random.nextInt(10_000).max(1).sat),
dustLimit = Random.nextInt(1000).sat,
- // We make sure both sides have enough to send/receive at least the initial pending HTLCs.
- toLocal = maxPendingHtlcAmount * 2 * 10 + Random.nextInt(1000000000).msat,
- toRemote = maxPendingHtlcAmount * 2 * 10 + Random.nextInt(1000000000).msat)
+ // We make sure both sides have enough to send/receive at least the initial pending HTLCs while paying the commit fees.
+ toLocal = maxPendingHtlcAmount * 2 * 15 + Random.nextInt(1_000_000_000).msat,
+ toRemote = maxPendingHtlcAmount * 2 * 15 + Random.nextInt(1_000_000_000).msat)
var c = CommitmentsSpec.makeCommitments(t.toLocal, t.toRemote, t.feeRatePerKw, t.dustLimit, t.isInitiator)
// Add some initial HTLCs to the pending list (bigger commit tx).
for (_ <- 1 to t.pendingHtlcs) {
@@ -433,7 +433,7 @@ class CommitmentsSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with
val (_, cmdAdd) = makeCmdAdd(amount, randomKey().publicKey, f.currentBlockHeight)
c.sendAdd(cmdAdd, f.currentBlockHeight, TestConstants.Alice.nodeParams.channelConf, feeConfNoMismatch) match {
case Right((cc, _)) => c = cc
- case Left(e) => ignore(s"$t -> could not setup initial htlcs: $e")
+ case Left(e) => // we ignore failures (the HTLC amount probably exceeded availableBalanceForSend)
}
}
if (c.availableBalanceForSend > 0.msat) {
@@ -445,17 +445,17 @@ class CommitmentsSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with
}
test("should always be able to receive availableForReceive", Tag("fuzzy")) { f =>
- val maxPendingHtlcAmount = 1000000.msat
+ val maxPendingHtlcAmount = 1_000_000.msat
case class FuzzTest(isInitiator: Boolean, pendingHtlcs: Int, feeRatePerKw: FeeratePerKw, dustLimit: Satoshi, toLocal: MilliSatoshi, toRemote: MilliSatoshi)
for (_ <- 1 to 100) {
val t = FuzzTest(
isInitiator = Random.nextInt(2) == 0,
pendingHtlcs = Random.nextInt(10),
- feeRatePerKw = FeeratePerKw(Random.nextInt(10000).max(1).sat),
+ feeRatePerKw = FeeratePerKw(Random.nextInt(10_000).max(1).sat),
dustLimit = Random.nextInt(1000).sat,
- // We make sure both sides have enough to send/receive at least the initial pending HTLCs.
- toLocal = maxPendingHtlcAmount * 2 * 10 + Random.nextInt(1000000000).msat,
- toRemote = maxPendingHtlcAmount * 2 * 10 + Random.nextInt(1000000000).msat)
+ // We make sure both sides have enough to send/receive at least the initial pending HTLCs while paying the commit fees.
+ toLocal = maxPendingHtlcAmount * 2 * 15 + Random.nextInt(1_000_000_000).msat,
+ toRemote = maxPendingHtlcAmount * 2 * 15 + Random.nextInt(1_000_000_000).msat)
var c = CommitmentsSpec.makeCommitments(t.toLocal, t.toRemote, t.feeRatePerKw, t.dustLimit, t.isInitiator)
// Add some initial HTLCs to the pending list (bigger commit tx).
for (_ <- 1 to t.pendingHtlcs) {
@@ -463,7 +463,7 @@ class CommitmentsSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with
val add = UpdateAddHtlc(randomBytes32(), c.changes.remoteNextHtlcId, amount, randomBytes32(), CltvExpiry(f.currentBlockHeight), TestConstants.emptyOnionPacket, None, accountable = false, None)
c.receiveAdd(add) match {
case Right(cc) => c = cc
- case Left(e) => ignore(s"$t -> could not setup initial htlcs: $e")
+ case Left(e) => // we ignore failures (the HTLC amount probably exceeded availableBalanceForReceive)
}
}
if (c.availableBalanceForReceive > 0.msat) {
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.