Skip to content

Commit

Permalink
Fix availableForSend fuzz tests (#2440)
Browse files Browse the repository at this point in the history
These two fuzz tests setup a random set of HTLCs and then try to send or
receive the maximum available amount. The initial HTLC setup may fail,
if the initial balances are too low.

It is hard to set those initial balances to ensure this will always work,
but since this will only rarely randomly happen, we should simply ignore
it (instead of failing the test).
  • Loading branch information
t-bast authored Sep 29, 2022
1 parent afdaf46 commit 6e381d4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ class CommitmentsSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with
val (_, cmdAdd) = makeCmdAdd(amount, randomKey().publicKey, f.currentBlockHeight)
sendAdd(c, cmdAdd, f.currentBlockHeight, feeConfNoMismatch) match {
case Right((cc, _)) => c = cc
case Left(e) => fail(s"$t -> could not setup initial htlcs: $e")
case Left(e) => ignore(s"$t -> could not setup initial htlcs: $e")
}
}
val (_, cmdAdd) = makeCmdAdd(c.availableBalanceForSend, randomKey().publicKey, f.currentBlockHeight)
Expand Down Expand Up @@ -460,7 +460,7 @@ class CommitmentsSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with
val add = UpdateAddHtlc(randomBytes32(), c.remoteNextHtlcId, amount, randomBytes32(), CltvExpiry(f.currentBlockHeight), TestConstants.emptyOnionPacket, None)
receiveAdd(c, add, feeConfNoMismatch) match {
case Right(cc) => c = cc
case Left(e) => fail(s"$t -> could not setup initial htlcs: $e")
case Left(e) => ignore(s"$t -> could not setup initial htlcs: $e")
}
}
val add = UpdateAddHtlc(randomBytes32(), c.remoteNextHtlcId, c.availableBalanceForReceive, randomBytes32(), CltvExpiry(f.currentBlockHeight), TestConstants.emptyOnionPacket, None)
Expand Down

0 comments on commit 6e381d4

Please sign in to comment.