Merge pull request #1582 from halseth/lnd-test-assert-waiting-close
[integration tests] assert waiting close also for force closes
This commit is contained in:
commit
205a32380a
24
lnd_test.go
24
lnd_test.go
@ -220,9 +220,8 @@ func closeChannelAndAssert(ctx context.Context, t *harnessTest,
|
||||
}
|
||||
chanPointStr := fmt.Sprintf("%v:%v", txid, fundingChanPoint.OutputIndex)
|
||||
|
||||
// If we didn't force close the transaction, at this point, the channel
|
||||
// should now be marked as being in the state of "waiting close".
|
||||
if !force {
|
||||
// At this point, the channel should now be marked as being in the
|
||||
// state of "waiting close".
|
||||
pendingChansRequest := &lnrpc.PendingChannelsRequest{}
|
||||
pendingChanResp, err := node.PendingChannels(ctx, pendingChansRequest)
|
||||
if err != nil {
|
||||
@ -238,7 +237,6 @@ func closeChannelAndAssert(ctx context.Context, t *harnessTest,
|
||||
if !found {
|
||||
t.Fatalf("channel not marked as waiting close")
|
||||
}
|
||||
}
|
||||
|
||||
// We'll now, generate a single block, wait for the final close status
|
||||
// update, then ensure that the closing transaction was included in the
|
||||
@ -254,8 +252,7 @@ func closeChannelAndAssert(ctx context.Context, t *harnessTest,
|
||||
|
||||
// Finally, the transaction should no longer be in the waiting close
|
||||
// state as we've just mined a block that should include the closing
|
||||
// transaction. This only applies for co-op close channels though.
|
||||
if !force {
|
||||
// transaction.
|
||||
err = lntest.WaitPredicate(func() bool {
|
||||
pendingChansRequest := &lnrpc.PendingChannelsRequest{}
|
||||
pendingChanResp, err := node.PendingChannels(
|
||||
@ -276,7 +273,6 @@ func closeChannelAndAssert(ctx context.Context, t *harnessTest,
|
||||
if err != nil {
|
||||
t.Fatalf("closing transaction not marked as fully closed")
|
||||
}
|
||||
}
|
||||
|
||||
return closingTxid
|
||||
}
|
||||
@ -8130,21 +8126,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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user