Skip to content

Commit 7497d4b

Browse files
committedDec 18, 2024
itest: enhance and adopt itests.
We test that a public zeroconf channel is gossiped through the network after 6 confirmation. Moreover itests had to be adopted because we are now sending an additional ChanUpdate msg for normal public channels signaling the broadcasting to the broader network.
1 parent 10c82f6 commit 7497d4b

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed
 

‎itest/lnd_channel_policy_test.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ func testUpdateChannelPolicy(ht *lntest.HarnessTest) {
6969
)
7070
}
7171

72-
// Create Carol with options to rate limit channel updates up to 2 per
72+
// Create Carol with options to rate limit channel updates up to 3 per
7373
// day, and create a new channel Bob->Carol.
7474
carol := ht.NewNode(
7575
"Carol", []string{
76-
"--gossip.max-channel-update-burst=2",
76+
"--gossip.max-channel-update-burst=3",
7777
"--gossip.channel-update-interval=24h",
7878
},
7979
)
@@ -413,13 +413,17 @@ func testUpdateChannelPolicy(ht *lntest.HarnessTest) {
413413
req.BaseFeeMsat = baseFee2
414414
assertAliceAndBob(req, expectedPolicy)
415415

416-
// Since Carol didn't receive the last update, she still has Alice's
417-
// old policy. We validate this by checking the base fee is the older
418-
// one.
419-
expectedPolicy.FeeBaseMsat = baseFee1
416+
// Because this is not a direct channel we anticipate the new policy.
420417
ht.AssertChannelPolicy(
421418
carol, alice.PubKeyStr, expectedPolicy, chanPoint,
422419
)
420+
421+
// Since Carol didn't receive the last update, she still has Alice's
422+
// old policy. We validate this by checking the base fee is the older
423+
// one. This only applies to direct channels because we have an
424+
// additional ChanUpdate which is sent after the channel reaches the min
425+
// depth of six confirmations.
426+
expectedPolicy.FeeBaseMsat = baseFee1
423427
ht.AssertChannelPolicy(
424428
carol, alice.PubKeyStr, expectedPolicy, chanPoint3,
425429
)

‎lntest/harness.go

+11
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,12 @@ func (h *HarnessTest) OpenChannel(alice, bob *node.HarnessNode,
11601160
// First, open the channel without announcing it.
11611161
cp := h.OpenChannelNoAnnounce(alice, bob, p)
11621162

1163+
// We need to make sure we wait here for 1 second so the ChanUpdate
1164+
// after 6 confirmations are reached is not considered stale. This
1165+
// ChanUpdate is important because it unsets the __dont_forward__ bit
1166+
// signaling the broadcasting to the network.
1167+
time.Sleep(time.Second)
1168+
11631169
// If this is a private channel, there's no need to mine extra blocks
11641170
// since it will never be announced to the network.
11651171
if p.Private {
@@ -1850,6 +1856,11 @@ func (h *HarnessTest) OpenMultiChannelsAsync(
18501856
// Mine one block to confirm all the funding transactions.
18511857
h.MineBlocksAndAssertNumTxes(1, len(reqs))
18521858

1859+
// This sleep is needed otherwise our own ChanUpdate messages might be
1860+
// considered as stale (same timestamp), failing to deliver a ChanUpdate
1861+
// to the gossiper with the unset __dont_forward__.
1862+
time.Sleep(time.Second)
1863+
18531864
// Mine 5 more blocks so all the public channels are announced to the
18541865
// network.
18551866
h.MineBlocks(numBlocksOpenChannel - 1)

0 commit comments

Comments
 (0)