itest: reduce blocks mined to save sync time
This commit is contained in:
11 files changed
+46
-29
No files matched your search
@@ -990,7 +990,7 @@ func testChanRestoreScenario(ht *lntemp.HarnessTest,
|
||||
var fundingShim *lnrpc.FundingShim
|
||||
if testCase.commitmentType == lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE {
|
||||
_, minerHeight := ht.Miner.GetBestBlock()
|
||||
thawHeight := uint32(minerHeight + 144)
|
||||
thawHeight := uint32(minerHeight + thawHeightDelta)
|
||||
|
||||
fundingShim, _, _ = deriveFundingShim(
|
||||
ht, from, to, chanAmt, thawHeight, true,
|
||||
@@ -1512,7 +1512,7 @@ func assertTimeLockSwept(ht *lntemp.HarnessTest,
|
||||
// The commit sweep resolver publishes the sweep tx at defaultCSV-1 and
|
||||
// we already mined one block after the commitment was published, so
|
||||
// take that into account.
|
||||
ht.Miner.MineBlocks(defaultCSV - 1 - 1)
|
||||
ht.MineBlocksAssertNodesSync(defaultCSV - 1 - 1)
|
||||
daveSweep := ht.Miner.AssertNumTxsInMempool(1)[0]
|
||||
block := ht.Miner.MineBlocksAndAssertNumTxes(1, 1)[0]
|
||||
ht.Miner.AssertTxInBlock(block, daveSweep)
|
||||
|
||||
@@ -23,8 +23,6 @@ import (
|
||||
func testMultiHopHtlcAggregation(ht *lntemp.HarnessTest,
|
||||
alice, bob *node.HarnessNode, c lnrpc.CommitmentType, zeroConf bool) {
|
||||
|
||||
const finalCltvDelta = 40
|
||||
|
||||
// First, we'll create a three hop network: Alice -> Bob -> Carol.
|
||||
aliceChanPoint, bobChanPoint, carol := createThreeHopNetwork(
|
||||
ht, alice, bob, false, c, zeroConf,
|
||||
|
||||
@@ -35,7 +35,7 @@ func testMultiHopHtlcLocalChainClaim(ht *lntemp.HarnessTest,
|
||||
payHash := preimage.Hash()
|
||||
invoiceReq := &invoicesrpc.AddHoldInvoiceRequest{
|
||||
Value: invoiceAmt,
|
||||
CltvExpiry: 40,
|
||||
CltvExpiry: finalCltvDelta,
|
||||
Hash: payHash[:],
|
||||
}
|
||||
carolInvoice := carol.RPC.AddHoldInvoice(invoiceReq)
|
||||
|
||||
@@ -30,9 +30,8 @@ func testMultiHopHtlcLocalTimeout(ht *lntemp.HarnessTest,
|
||||
// to Carol. The first HTLC will be universally considered "dust",
|
||||
// while the second will be a proper fully valued HTLC.
|
||||
const (
|
||||
dustHtlcAmt = btcutil.Amount(100)
|
||||
htlcAmt = btcutil.Amount(300_000)
|
||||
finalCltvDelta = 40
|
||||
dustHtlcAmt = btcutil.Amount(100)
|
||||
htlcAmt = btcutil.Amount(300_000)
|
||||
)
|
||||
|
||||
// We'll create two random payment hashes unknown to carol, then send
|
||||
|
||||
@@ -37,7 +37,7 @@ func testMultiHopReceiverChainClaim(ht *lntemp.HarnessTest,
|
||||
payHash := preimage.Hash()
|
||||
invoiceReq := &invoicesrpc.AddHoldInvoiceRequest{
|
||||
Value: invoiceAmt,
|
||||
CltvExpiry: 40,
|
||||
CltvExpiry: finalCltvDelta,
|
||||
Hash: payHash[:],
|
||||
}
|
||||
carolInvoice := carol.RPC.AddHoldInvoice(invoiceReq)
|
||||
|
||||
@@ -36,7 +36,7 @@ func testMultiHopHtlcRemoteChainClaim(ht *lntemp.HarnessTest,
|
||||
payHash := preimage.Hash()
|
||||
invoiceReq := &invoicesrpc.AddHoldInvoiceRequest{
|
||||
Value: invoiceAmt,
|
||||
CltvExpiry: 40,
|
||||
CltvExpiry: finalCltvDelta,
|
||||
Hash: payHash[:],
|
||||
}
|
||||
carolInvoice := carol.RPC.AddHoldInvoice(invoiceReq)
|
||||
|
||||
@@ -28,10 +28,7 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest,
|
||||
// With our channels set up, we'll then send a single HTLC from Alice
|
||||
// to Carol. As Carol is in hodl mode, she won't settle this HTLC which
|
||||
// opens up the base for out tests.
|
||||
const (
|
||||
finalCltvDelta = 40
|
||||
htlcAmt = btcutil.Amount(300_000)
|
||||
)
|
||||
const htlcAmt = btcutil.Amount(300_000)
|
||||
|
||||
// We'll now send a single HTLC across our multi-hop network.
|
||||
carolPubKey := carol.PubKey[:]
|
||||
|
||||
@@ -30,10 +30,7 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest,
|
||||
// With our channels set up, we'll then send a single HTLC from Alice
|
||||
// to Carol. As Carol is in hodl mode, she won't settle this HTLC which
|
||||
// opens up the base for out tests.
|
||||
const (
|
||||
finalCltvDelta = 40
|
||||
htlcAmt = btcutil.Amount(30000)
|
||||
)
|
||||
const htlcAmt = btcutil.Amount(30000)
|
||||
|
||||
// We'll now send a single HTLC across our multi-hop network.
|
||||
var preimage lntypes.Preimage
|
||||
@@ -41,7 +38,7 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(ht *lntemp.HarnessTest,
|
||||
payHash := preimage.Hash()
|
||||
invoiceReq := &invoicesrpc.AddHoldInvoiceRequest{
|
||||
Value: int64(htlcAmt),
|
||||
CltvExpiry: 40,
|
||||
CltvExpiry: finalCltvDelta,
|
||||
Hash: payHash[:],
|
||||
}
|
||||
carolInvoice := carol.RPC.AddHoldInvoice(invoiceReq)
|
||||
|
||||
@@ -15,6 +15,12 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lntemp/rpc"
|
||||
"github.com/lightningnetwork/lnd/lntest"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/routing"
|
||||
)
|
||||
|
||||
const (
|
||||
finalCltvDelta = routing.MinCLTVDelta // 18.
|
||||
thawHeightDelta = finalCltvDelta * 2 // 36.
|
||||
)
|
||||
|
||||
func testMultiHopHtlcClaims(ht *lntemp.HarnessTest) {
|
||||
@@ -280,9 +286,12 @@ func createThreeHopNetwork(ht *lntemp.HarnessTest,
|
||||
// needs to be attached as an additional input. This can still lead to
|
||||
// a positively-yielding transaction.
|
||||
for i := 0; i < 2; i++ {
|
||||
ht.FundCoins(btcutil.SatoshiPerBitcoin, alice)
|
||||
ht.FundCoins(btcutil.SatoshiPerBitcoin, bob)
|
||||
ht.FundCoins(btcutil.SatoshiPerBitcoin, carol)
|
||||
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, alice)
|
||||
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, bob)
|
||||
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, carol)
|
||||
|
||||
// Mine 1 block to get the above coins confirmed.
|
||||
ht.MineBlocksAssertNodesSync(1)
|
||||
}
|
||||
|
||||
// We'll start the test by creating a channel between Alice and Bob,
|
||||
@@ -292,7 +301,7 @@ func createThreeHopNetwork(ht *lntemp.HarnessTest,
|
||||
var thawHeight uint32
|
||||
if c == lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE {
|
||||
_, minerHeight := ht.Miner.GetBestBlock()
|
||||
thawHeight = uint32(minerHeight + 144)
|
||||
thawHeight = uint32(minerHeight + thawHeightDelta)
|
||||
aliceFundingShim, _, _ = deriveFundingShim(
|
||||
ht, alice, bob, chanAmt, thawHeight, true,
|
||||
)
|
||||
|
||||
@@ -127,10 +127,6 @@ func TestLightningNetworkDaemonTemp(t *testing.T) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
_, height := harnessTest.Miner.GetBestBlock()
|
||||
t.Logf("=========> tests finished for tranche: %v, tested %d "+
|
||||
"cases, end height: %d\n", trancheIndex, len(testCases), height)
|
||||
}
|
||||
|
||||
// getTestCaseSplitTranche returns the sub slice of the test cases that should
|
||||
|
||||
Reference in new issue
Block a user