diff --git a/itest/list_on_test.go b/itest/list_on_test.go index 435c560122..fc9c12111e 100644 --- a/itest/list_on_test.go +++ b/itest/list_on_test.go @@ -549,8 +549,12 @@ var allTestCases = []*lntest.TestCase{ TestFunc: testCustomFeatures, }, { - Name: "update pending open channels", - TestFunc: testUpdateOnPendingOpenChannels, + Name: "update pending open channels on funder side", + TestFunc: testUpdateOnFunderPendingOpenChannels, + }, + { + Name: "update pending open channels on fundee side", + TestFunc: testUpdateOnFundeePendingOpenChannels, }, { Name: "blinded payment htlc re-forward", diff --git a/itest/lnd_open_channel_test.go b/itest/lnd_open_channel_test.go index eb9e1c0584..9d51fc5635 100644 --- a/itest/lnd_open_channel_test.go +++ b/itest/lnd_open_channel_test.go @@ -3,7 +3,6 @@ package itest import ( "fmt" "strings" - "testing" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg/chainhash" @@ -614,27 +613,6 @@ func runBasicChannelCreationAndUpdates(ht *lntest.HarnessTest, ) } -// testUpdateOnPendingOpenChannels checks that `update_add_htlc` followed by -// `channel_ready` is properly handled. In specific, when a node is in a state -// that it's still processing a remote `channel_ready` message, meanwhile an -// `update_add_htlc` is received, this HTLC message is cached and settled once -// processing `channel_ready` is complete. -func testUpdateOnPendingOpenChannels(ht *lntest.HarnessTest) { - // Test funder's behavior. Funder sees the channel pending, but fundee - // sees it active and sends an HTLC. - ht.Run("pending on funder side", func(t *testing.T) { - st := ht.Subtest(t) - testUpdateOnFunderPendingOpenChannels(st) - }) - - // Test fundee's behavior. Fundee sees the channel pending, but funder - // sees it active and sends an HTLC. - ht.Run("pending on fundee side", func(t *testing.T) { - st := ht.Subtest(t) - testUpdateOnFundeePendingOpenChannels(st) - }) -} - // testUpdateOnFunderPendingOpenChannels checks that when the fundee sends an // `update_add_htlc` followed by `channel_ready` while the funder is still // processing the fundee's `channel_ready`, the HTLC will be cached and @@ -658,7 +636,8 @@ func testUpdateOnFunderPendingOpenChannels(ht *lntest.HarnessTest) { Amt: funding.MaxBtcFundingAmount, PushAmt: funding.MaxBtcFundingAmount / 2, } - ht.OpenChannelAssertPending(alice, bob, params) + pending := ht.OpenChannelAssertPending(alice, bob, params) + chanPoint := lntest.ChanPointFromPendingUpdate(pending) // Alice and Bob should both consider the channel pending open. ht.AssertNumPendingOpenChannels(alice, 1) @@ -676,6 +655,7 @@ func testUpdateOnFunderPendingOpenChannels(ht *lntest.HarnessTest) { // Bob will consider the channel open as there's no wait time to send // and receive Alice's channel_ready message. ht.AssertNumPendingOpenChannels(bob, 0) + ht.AssertChannelInGraph(bob, chanPoint) // Alice and Bob now have different view of the channel. For Bob, // since the channel_ready messages are processed, he will have a @@ -732,7 +712,8 @@ func testUpdateOnFundeePendingOpenChannels(ht *lntest.HarnessTest) { params := lntest.OpenChannelParams{ Amt: funding.MaxBtcFundingAmount, } - ht.OpenChannelAssertPending(alice, bob, params) + pending := ht.OpenChannelAssertPending(alice, bob, params) + chanPoint := lntest.ChanPointFromPendingUpdate(pending) // Alice and Bob should both consider the channel pending open. ht.AssertNumPendingOpenChannels(alice, 1) @@ -744,6 +725,7 @@ func testUpdateOnFundeePendingOpenChannels(ht *lntest.HarnessTest) { // Alice will consider the channel open as there's no wait time to send // and receive Bob's channel_ready message. ht.AssertNumPendingOpenChannels(alice, 0) + ht.AssertChannelInGraph(alice, chanPoint) // TODO(yy): we've prematurely marked the channel as open before // processing channel ready messages. We need to mark it as open after