lnd_test: remove racy block generation
This commit removes the mining of a block within the integration tests, that would lead to a flake during runs. The reason was that the sweeoing transaction was actually broadcast already at this point, and this block was mined with the assumption that it wasn't. However, test would pass more often than not because the UTXO nursery would be working on graduating new heights, whcih is a bit slow, so in most cases the block would be mined before it had broadcast the sweeping transaction. By removing this block we ensure that the sweeping transaction will be found for sure in the waitForTxInMempool call below.
This commit is contained in:
parent
4ab2bba5c7
commit
23f67ef009
11
lnd_test.go
11
lnd_test.go
@ -6957,7 +6957,7 @@ func testMultHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
|
||||
t.Fatalf("unable to send alice htlc: %v", err)
|
||||
}
|
||||
|
||||
// Once the HTLC has cleared, all the nodes n our mini network should
|
||||
// Once the HTLC has cleared, all the nodes in our mini network should
|
||||
// show that the HTLC has been locked in.
|
||||
var predErr error
|
||||
nodes := []*lntest.HarnessNode{net.Alice, net.Bob, carol}
|
||||
@ -7004,7 +7004,8 @@ func testMultHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
|
||||
}
|
||||
|
||||
// Next, we'll mine enough blocks for the HTLC to expire. At this
|
||||
// point, Bob should hand off the output to his internal utxo nursery.
|
||||
// point, Bob should hand off the output to his internal utxo nursery,
|
||||
// which will broadcast a sweep transaction.
|
||||
if _, err := net.Miner.Node.Generate(finalCltvDelta - 1); err != nil {
|
||||
t.Fatalf("unable to generate blocks: %v", err)
|
||||
}
|
||||
@ -7046,12 +7047,6 @@ func testMultHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
|
||||
t.Fatalf("bob didn't hand off time-locked HTLC: %v", predErr)
|
||||
}
|
||||
|
||||
// We'll now mine an additional block to push the HTLC to full
|
||||
// expiration.
|
||||
if _, err := net.Miner.Node.Generate(1); err != nil {
|
||||
t.Fatalf("unable to generate block: %v", err)
|
||||
}
|
||||
|
||||
// Bob's sweeping transaction should now be found in the mempool at
|
||||
// this point.
|
||||
_, err = waitForTxInMempool(net.Miner.Node, time.Second*20)
|
||||
|
Loading…
Reference in New Issue
Block a user