lntest+itest: make Miner a private instance

This commit is contained in:
yyforyongyu authored and yyforyongyu committed 2024-07-23 21:30:08 +08:00
1 parent be4dba5da6
commit 14e7b134d9
9 files changed
+61 -51

No files matched your search

+1 -1
View File
@@ -709,7 +709,7 @@ func channelForceClosureTest(ht *lntest.HarnessTest,
// NOTE: we don't check `len(mempool) == 1` because it will
// give us false positive.
err := wait.NoError(func() error {
mempool := ht.Miner.GetRawMempool()
mempool := ht.Miner().GetRawMempool()
if len(mempool) == 2 {
return nil
}
+1 -1
View File
@@ -125,7 +125,7 @@ func testNonStdSweepInner(ht *lntest.HarnessTest, address string) {
// Fetch the vsize of the transaction so we can determine if the
// transaction pays >= 1 sat/vbyte.
rawTx := ht.Miner.GetRawTransactionVerbose(txid)
rawTx := ht.Miner().GetRawTransactionVerbose(txid)
// Require fee >= vbytes.
require.True(ht, fee >= int(rawTx.Vsize))
+1 -1
View File
@@ -32,7 +32,7 @@ func testOpenChannelAfterReorg(ht *lntest.HarnessTest) {
// Create a temp miner.
tempMiner := ht.SpawnTempMiner()
miner := ht.Miner
miner := ht.Miner()
alice, bob := ht.Alice, ht.Bob
// Create a new channel that requires 1 confs before it's considered
+2 -2
View File
@@ -296,7 +296,7 @@ func wsTestCaseSubscription(ht *lntest.HarnessTest) {
}()
// Mine a block and make sure we get a message for it.
blockHashes := ht.Miner.GenerateBlocks(1)
blockHashes := ht.Miner().GenerateBlocks(1)
select {
case msg := <-msgChan:
require.Equal(
@@ -388,7 +388,7 @@ func wsTestCaseSubscriptionMacaroon(ht *lntest.HarnessTest) {
}()
// Mine a block and make sure we get a message for it.
blockHashes := ht.Miner.GenerateBlocks(1)
blockHashes := ht.Miner().GenerateBlocks(1)
select {
case msg := <-msgChan:
require.Equal(
+1 -1
View File
@@ -579,7 +579,7 @@ func revokedCloseRetributionRemoteHodlCase(ht *lntest.HarnessTest,
// NOTE: We don't use `ht.GetRawTransaction`
// which asserts a txid must be found as the HTLC
// spending txes might be aggregated.
tx, err := ht.Miner.Client.GetRawTransaction(txid)
tx, err := ht.Miner().Client.GetRawTransaction(txid)
if err != nil {
return nil, err
}
+6 -6
View File
@@ -172,7 +172,7 @@ func testSweepCPFPAnchorOutgoingTimeout(ht *lntest.HarnessTest) {
// Remember the force close height so we can calculate the deadline
// height.
_, forceCloseHeight := ht.Miner.GetBestBlock()
_, forceCloseHeight := ht.GetBestBlock()
// Bob should have two pending sweeps,
// - anchor sweeping from his local commitment.
@@ -304,7 +304,7 @@ func testSweepCPFPAnchorOutgoingTimeout(ht *lntest.HarnessTest) {
//
// Once out of the above loop, we expect to be 2 blocks before the CPFP
// deadline.
_, currentHeight := ht.Miner.GetBestBlock()
_, currentHeight := ht.GetBestBlock()
require.Equal(ht, int(anchorDeadline-2), int(currentHeight))
// Mine one more block, we'd use up all the CPFP budget.
@@ -512,7 +512,7 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
forceCloseHeight := htlc.ExpirationHeight - goToChainDelta
// Mine till the goToChainHeight is reached.
_, currentHeight := ht.Miner.GetBestBlock()
_, currentHeight := ht.GetBestBlock()
numBlocks := forceCloseHeight - uint32(currentHeight)
ht.MineEmptyBlocks(int(numBlocks))
@@ -641,7 +641,7 @@ func testSweepCPFPAnchorIncomingTimeout(ht *lntest.HarnessTest) {
//
// Once out of the above loop, we expect to be 2 blocks before the CPFP
// deadline.
_, currentHeight = ht.Miner.GetBestBlock()
_, currentHeight = ht.GetBestBlock()
require.Equal(ht, int(anchorDeadline-2), int(currentHeight))
// Mine one more block, we'd use up all the CPFP budget.
@@ -1380,7 +1380,7 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
//
// TODO(yy): assert they are equal once blocks are synced via
// `blockbeat`.
_, currentHeight := ht.Miner.GetBestBlock()
_, currentHeight := ht.GetBestBlock()
actualDeadline := int32(pendingSweepBob.DeadlineHeight) - currentHeight
if actualDeadline != int32(deadlineB) {
ht.Logf("!!! Found unsynced block between sweeper and "+
@@ -1438,7 +1438,7 @@ func testSweepCommitOutputAndAnchor(ht *lntest.HarnessTest) {
//
// TODO(yy): assert they are equal once blocks are synced via
// `blockbeat`.
_, currentHeight = ht.Miner.GetBestBlock()
_, currentHeight = ht.GetBestBlock()
actualDeadline = int32(aliceCommit.DeadlineHeight) - currentHeight
if actualDeadline != int32(deadlineA) {
ht.Logf("!!! Found unsynced block between Alice's sweeper and "+
+1 -1
View File
@@ -96,7 +96,7 @@ func testTaprootSendCoinsKeySpendBip86(ht *lntest.HarnessTest,
// Assert this is a segwit v1 address that starts with bcrt1p.
require.Contains(
ht, p2trResp.Address, ht.Miner.ActiveNet.Bech32HRPSegwit+"1p",
ht, p2trResp.Address, ht.Miner().ActiveNet.Bech32HRPSegwit+"1p",
)
// Send the coins from Alice's wallet to her own, but to the new p2tr