lntest+itest: add method AssertNumTxsInMempool and AssertTxInBlock

in harness

Prepare to make `HarnessTest.Miner` a private instance to sync height.
This commit is contained in:
yyforyongyu
2024-05-01 19:21:00 +08:00
committed by yyforyongyu
parent e553895ddd
commit 976bb37972
20 changed files with 108 additions and 93 deletions

View File

@@ -45,7 +45,7 @@ func testOpenChannelAfterReorg(ht *lntest.HarnessTest) {
// Wait for miner to have seen the funding tx. The temporary miner is
// disconnected, and won't see the transaction.
ht.Miner.AssertNumTxsInMempool(1)
ht.AssertNumTxsInMempool(1)
// At this point, the channel's funding transaction will have been
// broadcast, but not confirmed, and the channel should be pending.
@@ -59,7 +59,7 @@ func testOpenChannelAfterReorg(ht *lntest.HarnessTest) {
// channel on the original miner's chain, which should be considered
// open.
block := ht.MineBlocksAndAssertNumTxes(10, 1)[0]
ht.Miner.AssertTxInBlock(block, fundingTxID)
ht.AssertTxInBlock(block, fundingTxID)
_, err = tempMiner.Client.Generate(15)
require.NoError(ht, err, "unable to generate blocks")
@@ -115,7 +115,7 @@ func testOpenChannelAfterReorg(ht *lntest.HarnessTest) {
// Cleanup by mining the funding tx again, then closing the channel.
block = ht.MineBlocksAndAssertNumTxes(1, 1)[0]
ht.Miner.AssertTxInBlock(block, fundingTxID)
ht.AssertTxInBlock(block, fundingTxID)
ht.CloseChannel(alice, chanPoint)
}