Skip to content

Commit 8240a87

Browse files
committed
itest: fix misuse of MineBlocks and replace it with
`MineBlocksAndAssertNumTxes`
1 parent f1f3410 commit 8240a87

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

itest/lnd_channel_backup_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func newChanRestoreScenario(ht *lntest.HarnessTest, ct lnrpc.CommitmentType,
9494
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, dave)
9595

9696
// Mine a block to confirm the funds.
97-
ht.MineBlocks(1)
97+
ht.MineBlocksAndAssertNumTxes(1, 2)
9898

9999
// For the anchor output case we need two UTXOs for Carol so she can
100100
// sweep both the local and remote anchor.

itest/lnd_estimate_route_fee_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ func testEstimateRouteFee(ht *lntest.HarnessTest) {
359359

360360
mts.ht.CloseChannelAssertPending(mts.bob, channelPointBobPaula, false)
361361
mts.ht.CloseChannelAssertPending(mts.eve, channelPointEvePaula, false)
362+
ht.MineBlocksAndAssertNumTxes(1, 2)
363+
362364
mts.closeChannels()
363365
}
364366

itest/lnd_mpp_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ func newMppTestScenario(ht *lntest.HarnessTest) *mppTestScenario {
208208
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, carol)
209209
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, dave)
210210
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, eve)
211-
ht.MineBlocks(1)
211+
212+
ht.MineBlocksAndAssertNumTxes(1, 3)
212213
}
213214

214215
mts := &mppTestScenario{
@@ -318,7 +319,7 @@ func (m *mppTestScenario) closeChannels() {
318319
m.ht.CloseChannelAssertPending(m.eve, m.channelPoints[5], false)
319320

320321
// Now mine a block to include all the closing transactions.
321-
m.ht.MineBlocks(1)
322+
m.ht.MineBlocksAndAssertNumTxes(1, 6)
322323

323324
// Assert that the channels are closed.
324325
for _, hn := range m.nodes {

itest/lnd_multi-hop_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,7 +2223,7 @@ func createThreeHopNetwork(ht *lntest.HarnessTest,
22232223
ht.FundCoinsUnconfirmed(btcutil.SatoshiPerBitcoin, carol)
22242224

22252225
// Mine 1 block to get the above coins confirmed.
2226-
ht.MineBlocks(1)
2226+
ht.MineBlocksAndAssertNumTxes(1, 3)
22272227
}
22282228

22292229
// We'll start the test by creating a channel between Alice and Bob,
@@ -2703,8 +2703,14 @@ func runExtraPreimageFromLocalCommit(ht *lntest.HarnessTest,
27032703
// Make sure the direct spend tx is still in the mempool.
27042704
ht.AssertOutpointInMempool(htlcOutpoint)
27052705

2706-
// Mine a block to confirm Carol's direct spend tx.
2707-
ht.MineBlocks(1)
2706+
// Mine a block to confirm two txns,
2707+
// - Carol's direct spend tx.
2708+
// - Bob's to_local output sweep tx.
2709+
if c != lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE {
2710+
ht.MineBlocksAndAssertNumTxes(1, 2)
2711+
} else {
2712+
ht.MineBlocksAndAssertNumTxes(1, 1)
2713+
}
27082714
}
27092715

27102716
// Finally, check that the Alice's payment is marked as succeeded as

itest/lnd_onchain_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
601601
Index: 1,
602602
}
603603
ht.AssertOutpointInMempool(commitSweepOp)
604-
ht.MineBlocks(1)
604+
ht.MineBlocksAndAssertNumTxes(1, 1)
605605

606606
ht.AssertNumWaitingClose(alice, 0)
607607
}

itest/lnd_recovery_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,7 @@ func testRescanAddressDetection(ht *lntest.HarnessTest) {
428428
})
429429

430430
// Wait until the spending tx is found and mine a block to confirm it.
431-
ht.AssertNumTxsInMempool(1)
432-
ht.MineBlocks(1)
431+
ht.MineBlocksAndAssertNumTxes(1, 1)
433432

434433
// The wallet should still just see a single UTXO of the change output
435434
// created earlier.

itest/lnd_res_handoff_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func testResHandoff(ht *lntest.HarnessTest) {
6666
ht.AssertNumWaitingClose(bob, 1)
6767

6868
// Mine a block to confirm the closing tx.
69-
ht.MineBlocks(1)
69+
ht.MineBlocksAndAssertNumTxes(1, 1)
7070

7171
// We sleep here so we can be sure that the hand-off has occurred from
7272
// Bob's contractcourt to Bob's htlcswitch. This sleep could be removed

lntest/harness_miner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (h *HarnessTest) MineBlocksAndAssertNumTxes(num uint32,
104104
txids := h.AssertNumTxsInMempool(numTxs)
105105

106106
// Mine blocks.
107-
blocks := h.miner.MineBlocksSlow(num)
107+
blocks := h.miner.MineBlocks(num)
108108

109109
// Assert that all the transactions were included in the first block.
110110
for _, txid := range txids {

0 commit comments

Comments
 (0)