Merge pull request #7646 from yyforyongyu/itest-reduce-blocks
itest: mine less blocks to speed up tests
This commit is contained in:
3 files changed
+85
-66
No files matched your search
+40
-37
@@ -13,34 +13,10 @@ var allTestCases = []*lntest.TestCase{
|
|||||||
Name: "basic funding flow",
|
Name: "basic funding flow",
|
||||||
TestFunc: testBasicChannelFunding,
|
TestFunc: testBasicChannelFunding,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "multi hop htlc local timeout",
|
|
||||||
TestFunc: testMultiHopHtlcLocalTimeout,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "multi hop receiver chain claim",
|
Name: "multi hop receiver chain claim",
|
||||||
TestFunc: testMultiHopReceiverChainClaim,
|
TestFunc: testMultiHopReceiverChainClaim,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "multi hop local force close on-chain htlc timeout",
|
|
||||||
TestFunc: testMultiHopLocalForceCloseOnChainHtlcTimeout,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "multi hop remote force close on-chain htlc timeout",
|
|
||||||
TestFunc: testMultiHopRemoteForceCloseOnChainHtlcTimeout,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "multi hop htlc local chain claim",
|
|
||||||
TestFunc: testMultiHopHtlcLocalChainClaim,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "multi hop htlc remote chain claim",
|
|
||||||
TestFunc: testMultiHopHtlcRemoteChainClaim,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "multi hop htlc aggregation",
|
|
||||||
TestFunc: testMultiHopHtlcAggregation,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "external channel funding",
|
Name: "external channel funding",
|
||||||
TestFunc: testExternalFundingChanPoint,
|
TestFunc: testExternalFundingChanPoint,
|
||||||
@@ -145,14 +121,6 @@ var allTestCases = []*lntest.TestCase{
|
|||||||
Name: "send update disable channel",
|
Name: "send update disable channel",
|
||||||
TestFunc: testSendUpdateDisableChannel,
|
TestFunc: testSendUpdateDisableChannel,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "private channel update policy",
|
|
||||||
TestFunc: testUpdateChannelPolicyForPrivateChannel,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "update channel policy fee rate accuracy",
|
|
||||||
TestFunc: testUpdateChannelPolicyFeeRateAccuracy,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "connection timeout",
|
Name: "connection timeout",
|
||||||
TestFunc: testNetworkConnectionTimeout,
|
TestFunc: testNetworkConnectionTimeout,
|
||||||
@@ -165,6 +133,26 @@ var allTestCases = []*lntest.TestCase{
|
|||||||
Name: "addpeer config",
|
Name: "addpeer config",
|
||||||
TestFunc: testAddPeerConfig,
|
TestFunc: testAddPeerConfig,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "multi hop htlc local timeout",
|
||||||
|
TestFunc: testMultiHopHtlcLocalTimeout,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "multi hop local force close on-chain htlc timeout",
|
||||||
|
TestFunc: testMultiHopLocalForceCloseOnChainHtlcTimeout,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "multi hop remote force close on-chain htlc timeout",
|
||||||
|
TestFunc: testMultiHopRemoteForceCloseOnChainHtlcTimeout,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "private channel update policy",
|
||||||
|
TestFunc: testUpdateChannelPolicyForPrivateChannel,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "update channel policy fee rate accuracy",
|
||||||
|
TestFunc: testUpdateChannelPolicyFeeRateAccuracy,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "unannounced channels",
|
Name: "unannounced channels",
|
||||||
TestFunc: testUnannouncedChannels,
|
TestFunc: testUnannouncedChannels,
|
||||||
@@ -297,6 +285,18 @@ var allTestCases = []*lntest.TestCase{
|
|||||||
Name: "REST API",
|
Name: "REST API",
|
||||||
TestFunc: testRestAPI,
|
TestFunc: testRestAPI,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "multi hop htlc local chain claim",
|
||||||
|
TestFunc: testMultiHopHtlcLocalChainClaim,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "multi hop htlc remote chain claim",
|
||||||
|
TestFunc: testMultiHopHtlcRemoteChainClaim,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "multi hop htlc aggregation",
|
||||||
|
TestFunc: testMultiHopHtlcAggregation,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "revoked uncooperative close retribution",
|
Name: "revoked uncooperative close retribution",
|
||||||
TestFunc: testRevokedCloseRetribution,
|
TestFunc: testRevokedCloseRetribution,
|
||||||
@@ -310,11 +310,6 @@ var allTestCases = []*lntest.TestCase{
|
|||||||
Name: "revoked uncooperative close retribution remote hodl",
|
Name: "revoked uncooperative close retribution remote hodl",
|
||||||
TestFunc: testRevokedCloseRetributionRemoteHodl,
|
TestFunc: testRevokedCloseRetributionRemoteHodl,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "revoked uncooperative close retribution altruist " +
|
|
||||||
"watchtower",
|
|
||||||
TestFunc: testRevokedCloseRetributionAltruistWatchtower,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "single-hop send to route",
|
Name: "single-hop send to route",
|
||||||
TestFunc: testSingleHopSendToRoute,
|
TestFunc: testSingleHopSendToRoute,
|
||||||
@@ -519,6 +514,14 @@ var allTestCases = []*lntest.TestCase{
|
|||||||
Name: "watchtower session management",
|
Name: "watchtower session management",
|
||||||
TestFunc: testWatchtowerSessionManagement,
|
TestFunc: testWatchtowerSessionManagement,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// NOTE: this test must be put in the same tranche as
|
||||||
|
// `testWatchtowerSessionManagement` to avoid parallel use of
|
||||||
|
// the default watchtower port.
|
||||||
|
Name: "revoked uncooperative close retribution altruist " +
|
||||||
|
"watchtower",
|
||||||
|
TestFunc: testRevokedCloseRetributionAltruistWatchtower,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "channel fundmax",
|
Name: "channel fundmax",
|
||||||
TestFunc: testChannelFundMax,
|
TestFunc: testChannelFundMax,
|
||||||
|
|||||||
+37
-28
@@ -1779,31 +1779,15 @@ func createThreeHopNetwork(ht *lntest.HarnessTest,
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
// Prepare params for Alice.
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
aliceParams := lntest.OpenChannelParams{
|
aliceParams := lntest.OpenChannelParams{
|
||||||
Amt: chanAmt,
|
Amt: chanAmt,
|
||||||
CommitmentType: c,
|
CommitmentType: c,
|
||||||
FundingShim: aliceFundingShim,
|
FundingShim: aliceFundingShim,
|
||||||
ZeroConf: zeroConf,
|
ZeroConf: zeroConf,
|
||||||
}
|
}
|
||||||
aliceChanPoint := ht.OpenChannel(alice, bob, aliceParams)
|
|
||||||
|
|
||||||
// Remove the ChannelAcceptor for Bob.
|
// We'll create a channel from Bob to Carol. After this channel is
|
||||||
if zeroConf {
|
|
||||||
cancel()
|
|
||||||
}
|
|
||||||
|
|
||||||
// We'll then create a channel from Bob to Carol. After this channel is
|
|
||||||
// open, our topology looks like: A -> B -> C.
|
// open, our topology looks like: A -> B -> C.
|
||||||
var bobFundingShim *lnrpc.FundingShim
|
var bobFundingShim *lnrpc.FundingShim
|
||||||
if c == lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE {
|
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
|
// Prepare params for Bob.
|
||||||
// being attempted.
|
|
||||||
if zeroConf {
|
|
||||||
acceptStream, cancel = carol.RPC.ChannelAcceptor()
|
|
||||||
go acceptChannel(ht.T, true, acceptStream)
|
|
||||||
}
|
|
||||||
|
|
||||||
bobParams := lntest.OpenChannelParams{
|
bobParams := lntest.OpenChannelParams{
|
||||||
Amt: chanAmt,
|
Amt: chanAmt,
|
||||||
CommitmentType: c,
|
CommitmentType: c,
|
||||||
FundingShim: bobFundingShim,
|
FundingShim: bobFundingShim,
|
||||||
ZeroConf: zeroConf,
|
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 {
|
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.
|
// Make sure alice and carol know each other's channels.
|
||||||
@@ -1932,6 +1936,11 @@ func runExtraPreimageFromRemoteCommit(ht *lntest.HarnessTest,
|
|||||||
// notice the force close from Carol.
|
// notice the force close from Carol.
|
||||||
require.NoError(ht, restartBob())
|
require.NoError(ht, restartBob())
|
||||||
|
|
||||||
|
// For anchor channels, Bob should sweep his anchor output.
|
||||||
|
if lntest.CommitTypeHasAnchors(c) {
|
||||||
|
ht.Miner.AssertNumTxsInMempool(1)
|
||||||
|
}
|
||||||
|
|
||||||
// Get the current height to compute number of blocks to mine to
|
// Get the current height to compute number of blocks to mine to
|
||||||
// trigger the htlc timeout resolver from Bob.
|
// trigger the htlc timeout resolver from Bob.
|
||||||
_, height := ht.Miner.GetBestBlock()
|
_, height := ht.Miner.GetBestBlock()
|
||||||
|
|||||||
@@ -732,7 +732,14 @@ func (hn *HarnessNode) Stop() error {
|
|||||||
// manually.
|
// manually.
|
||||||
hn.printErrf("found nil RPC clients")
|
hn.printErrf("found nil RPC clients")
|
||||||
if err := hn.Kill(); err != nil {
|
if err := hn.Kill(); err != nil {
|
||||||
return fmt.Errorf("killing process got: %v", err)
|
// Skip the error if the process is already dead.
|
||||||
|
if !strings.Contains(
|
||||||
|
err.Error(), "process already finished",
|
||||||
|
) {
|
||||||
|
|
||||||
|
return fmt.Errorf("killing process got: %w",
|
||||||
|
err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user