htlcswitch: fix flake in TestChannelLinkCancelFullCommitment

We bring down the max number of inflight HTLCs in the link's unit tests
to speed up the tests.
This commit is contained in:
yyforyongyu
2024-10-25 23:24:24 +08:00
parent c0e85d36ae
commit 8311bc56e5
3 changed files with 38 additions and 52 deletions

View File

@@ -43,6 +43,10 @@ import (
"github.com/stretchr/testify/require"
)
// maxInflightHtlcs specifies the max number of inflight HTLCs. This number is
// chosen to be smaller than the default 483 so the test can run faster.
const maxInflightHtlcs = 50
var (
alicePrivKey = []byte("alice priv key")
bobPrivKey = []byte("bob priv key")
@@ -145,7 +149,7 @@ func createTestChannel(t *testing.T, alicePrivKey, bobPrivKey []byte,
channelCapacity),
ChanReserve: aliceReserve,
MinHTLC: 0,
MaxAcceptedHtlcs: input.MaxHTLCNumber / 2,
MaxAcceptedHtlcs: maxInflightHtlcs,
}
aliceCommitParams := channeldb.CommitmentParams{
DustLimit: btcutil.Amount(200),
@@ -157,7 +161,7 @@ func createTestChannel(t *testing.T, alicePrivKey, bobPrivKey []byte,
channelCapacity),
ChanReserve: bobReserve,
MinHTLC: 0,
MaxAcceptedHtlcs: input.MaxHTLCNumber / 2,
MaxAcceptedHtlcs: maxInflightHtlcs,
}
bobCommitParams := channeldb.CommitmentParams{
DustLimit: btcutil.Amount(800),