diff --git a/itest/lnd_multi-hop_test.go b/itest/lnd_multi-hop_test.go index 61b5cf9fa..d45a272be 100644 --- a/itest/lnd_multi-hop_test.go +++ b/itest/lnd_multi-hop_test.go @@ -1779,31 +1779,15 @@ func createThreeHopNetwork(ht *lntest.HarnessTest, ) } - var ( - cancel context.CancelFunc - acceptStream rpc.AcceptorClient - ) - // If a zero-conf channel is being opened, the nodes are signalling the - // zero-conf feature bit. Setup a ChannelAcceptor for the fundee. - if zeroConf { - acceptStream, cancel = bob.RPC.ChannelAcceptor() - go acceptChannel(ht.T, true, acceptStream) - } - + // Prepare params for Alice. aliceParams := lntest.OpenChannelParams{ Amt: chanAmt, CommitmentType: c, FundingShim: aliceFundingShim, ZeroConf: zeroConf, } - aliceChanPoint := ht.OpenChannel(alice, bob, aliceParams) - // Remove the ChannelAcceptor for Bob. - if zeroConf { - cancel() - } - - // We'll then create a channel from Bob to Carol. After this channel is + // We'll create a channel from Bob to Carol. After this channel is // open, our topology looks like: A -> B -> C. var bobFundingShim *lnrpc.FundingShim if c == lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE { @@ -1812,24 +1796,44 @@ func createThreeHopNetwork(ht *lntest.HarnessTest, ) } - // Setup a ChannelAcceptor for Carol if a zero-conf channel open is - // being attempted. - if zeroConf { - acceptStream, cancel = carol.RPC.ChannelAcceptor() - go acceptChannel(ht.T, true, acceptStream) - } - + // Prepare params for Bob. bobParams := lntest.OpenChannelParams{ Amt: chanAmt, CommitmentType: c, FundingShim: bobFundingShim, ZeroConf: zeroConf, } - bobChanPoint := ht.OpenChannel(bob, carol, bobParams) - // Remove the ChannelAcceptor for Carol. + var ( + acceptStreamBob rpc.AcceptorClient + acceptStreamCarol rpc.AcceptorClient + cancelBob context.CancelFunc + cancelCarol context.CancelFunc + ) + + // If a zero-conf channel is being opened, the nodes are signalling the + // zero-conf feature bit. Setup a ChannelAcceptor for the fundee. if zeroConf { - cancel() + acceptStreamBob, cancelBob = bob.RPC.ChannelAcceptor() + go acceptChannel(ht.T, true, acceptStreamBob) + + acceptStreamCarol, cancelCarol = carol.RPC.ChannelAcceptor() + go acceptChannel(ht.T, true, acceptStreamCarol) + } + + // Open channels in batch to save blocks mined. + reqs := []*lntest.OpenChannelRequest{ + {Local: alice, Remote: bob, Param: aliceParams}, + {Local: bob, Remote: carol, Param: bobParams}, + } + resp := ht.OpenMultiChannelsAsync(reqs) + aliceChanPoint := resp[0] + bobChanPoint := resp[1] + + // Remove the ChannelAcceptor for Bob and Carol. + if zeroConf { + cancelBob() + cancelCarol() } // Make sure alice and carol know each other's channels.