mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 08:55:59 +01:00
itest: fix misuse of MineBlocks
and replace it with
`MineBlocksAndAssertNumTxes`
This commit is contained in:
parent
f1f341095e
commit
8240a87c2b
8 changed files with 19 additions and 11 deletions
|
@ -94,7 +94,7 @@ func newChanRestoreScenario(ht *lntest.HarnessTest, ct lnrpc.CommitmentType,
|
|||
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, dave)
|
||||
|
||||
// Mine a block to confirm the funds.
|
||||
ht.MineBlocks(1)
|
||||
ht.MineBlocksAndAssertNumTxes(1, 2)
|
||||
|
||||
// For the anchor output case we need two UTXOs for Carol so she can
|
||||
// sweep both the local and remote anchor.
|
||||
|
|
|
@ -359,6 +359,8 @@ func testEstimateRouteFee(ht *lntest.HarnessTest) {
|
|||
|
||||
mts.ht.CloseChannelAssertPending(mts.bob, channelPointBobPaula, false)
|
||||
mts.ht.CloseChannelAssertPending(mts.eve, channelPointEvePaula, false)
|
||||
ht.MineBlocksAndAssertNumTxes(1, 2)
|
||||
|
||||
mts.closeChannels()
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,8 @@ func newMppTestScenario(ht *lntest.HarnessTest) *mppTestScenario {
|
|||
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, carol)
|
||||
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, dave)
|
||||
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, eve)
|
||||
ht.MineBlocks(1)
|
||||
|
||||
ht.MineBlocksAndAssertNumTxes(1, 3)
|
||||
}
|
||||
|
||||
mts := &mppTestScenario{
|
||||
|
@ -318,7 +319,7 @@ func (m *mppTestScenario) closeChannels() {
|
|||
m.ht.CloseChannelAssertPending(m.eve, m.channelPoints[5], false)
|
||||
|
||||
// Now mine a block to include all the closing transactions.
|
||||
m.ht.MineBlocks(1)
|
||||
m.ht.MineBlocksAndAssertNumTxes(1, 6)
|
||||
|
||||
// Assert that the channels are closed.
|
||||
for _, hn := range m.nodes {
|
||||
|
|
|
@ -2223,7 +2223,7 @@ func createThreeHopNetwork(ht *lntest.HarnessTest,
|
|||
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, carol)
|
||||
|
||||
// Mine 1 block to get the above coins confirmed.
|
||||
ht.MineBlocks(1)
|
||||
ht.MineBlocksAndAssertNumTxes(1, 3)
|
||||
}
|
||||
|
||||
// We'll start the test by creating a channel between Alice and Bob,
|
||||
|
@ -2703,8 +2703,14 @@ func runExtraPreimageFromLocalCommit(ht *lntest.HarnessTest,
|
|||
// Make sure the direct spend tx is still in the mempool.
|
||||
ht.AssertOutpointInMempool(htlcOutpoint)
|
||||
|
||||
// Mine a block to confirm Carol's direct spend tx.
|
||||
ht.MineBlocks(1)
|
||||
// Mine a block to confirm two txns,
|
||||
// - Carol's direct spend tx.
|
||||
// - Bob's to_local output sweep tx.
|
||||
if c != lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE {
|
||||
ht.MineBlocksAndAssertNumTxes(1, 2)
|
||||
} else {
|
||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, check that the Alice's payment is marked as succeeded as
|
||||
|
|
|
@ -601,7 +601,7 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
|
|||
Index: 1,
|
||||
}
|
||||
ht.AssertOutpointInMempool(commitSweepOp)
|
||||
ht.MineBlocks(1)
|
||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||
|
||||
ht.AssertNumWaitingClose(alice, 0)
|
||||
}
|
||||
|
|
|
@ -428,8 +428,7 @@ func testRescanAddressDetection(ht *lntest.HarnessTest) {
|
|||
})
|
||||
|
||||
// Wait until the spending tx is found and mine a block to confirm it.
|
||||
ht.AssertNumTxsInMempool(1)
|
||||
ht.MineBlocks(1)
|
||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||
|
||||
// The wallet should still just see a single UTXO of the change output
|
||||
// created earlier.
|
||||
|
|
|
@ -66,7 +66,7 @@ func testResHandoff(ht *lntest.HarnessTest) {
|
|||
ht.AssertNumWaitingClose(bob, 1)
|
||||
|
||||
// Mine a block to confirm the closing tx.
|
||||
ht.MineBlocks(1)
|
||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||
|
||||
// We sleep here so we can be sure that the hand-off has occurred from
|
||||
// Bob's contractcourt to Bob's htlcswitch. This sleep could be removed
|
||||
|
|
|
@ -104,7 +104,7 @@ func (h *HarnessTest) MineBlocksAndAssertNumTxes(num uint32,
|
|||
txids := h.AssertNumTxsInMempool(numTxs)
|
||||
|
||||
// Mine blocks.
|
||||
blocks := h.miner.MineBlocksSlow(num)
|
||||
blocks := h.miner.MineBlocks(num)
|
||||
|
||||
// Assert that all the transactions were included in the first block.
|
||||
for _, txid := range txids {
|
||||
|
|
Loading…
Add table
Reference in a new issue