lnd_test: correct that Bob can sweep immediately

This commit fixes a flake within the integration tests, where we would
mine a set of blocks before checking if Bob's sweep tx was in the
mempool. Usually this would pass since the blocks were generated before
the tx hit the miner's mempool, but sometimes it was mined and then we
would check the mempool.

This commit fixes this by correctly waiting immediately for Bob to sweep
his funds, as they are not time locked.
This commit is contained in:
Johan T. Halseth 2018-07-18 15:55:59 +02:00
parent 098cd940e3
commit f73a2f362e
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -8130,21 +8130,17 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
t.Fatalf(predErr.Error())
}
// We'll mine csvDelay blocks in order to generate the sweep transaction
// of Bob's funding output.
if _, err := net.Miner.Node.Generate(csvDelay - 1); err != nil {
t.Fatalf("unable to generate blocks: %v", err)
}
_, err = waitForTxInMempool(net.Miner.Node, 10*time.Second)
// Bob can sweep his output immediately.
_, err = waitForTxInMempool(net.Miner.Node, 20*time.Second)
if err != nil {
t.Fatalf("unable to find bob's funding output sweep tx: %v", err)
t.Fatalf("unable to find bob's funding output sweep tx: %v",
err)
}
// 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,
// which will broadcast a sweep transaction.
if _, err := net.Miner.Node.Generate(finalCltvDelta - csvDelay - 1); err != nil {
if _, err := net.Miner.Node.Generate(finalCltvDelta - 1); err != nil {
t.Fatalf("unable to generate blocks: %v", err)
}