lnd_test: correct force close test re: htlc limbo funds

This commit fixes a bug in the integration test, that
reliably fails after disabling the height hint cache.
The test originally asserted that the htlc funds were
in limbo, but was reading a stale copy of the force
close information. Recently, the test was amended to
provided a valid read of the force close in
96a079873a6da2f0a93adc30945971fc07c5e610. However,
the issue was not apparent until build against the
disabled height hint cache.

The test is now correct to assert that there are no
funds in limbo, as the commitment output has been
swept, but the htlcs are still in the contract
court, so the nursery is unaware of them. We also
add another sanity check to validate that there are
no pending htlcs on the force close at that point
in time.
This commit is contained in:
Conner Fromknecht 2018-08-26 19:55:38 -07:00
parent 98e7c968d4
commit a5b9279ca1
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -2411,15 +2411,22 @@ func testChannelForceClosure(net *lntest.NetworkHarness, t *harnessTest) {
t.Fatalf(err.Error()) t.Fatalf(err.Error())
} }
// The htlc funds will still be shown as limbo, since they are still in // The commitment funds will have been recovered after the commit txn
// their first stage. The commitment funds will have been recovered // was included in the last block. The htlc funds will not be shown in
// after the commit txn was included in the last block. // limbo, since they are still in their first stage and the nursery
// hasn't received them from the contract court.
forceClose, err := findForceClosedChannel(pendingChanResp, &op) forceClose, err := findForceClosedChannel(pendingChanResp, &op)
if err != nil { if err != nil {
t.Fatalf(err.Error()) t.Fatalf(err.Error())
} }
if forceClose.LimboBalance == 0 { err = checkPendingChannelNumHtlcs(forceClose, 0)
t.Fatalf("htlc funds should still be in limbo") if err != nil {
t.Fatalf("expected 0 pending htlcs, found %d",
len(forceClose.PendingHtlcs))
}
if forceClose.LimboBalance != 0 {
t.Fatalf("expected 0 funds in limbo, found %d",
forceClose.LimboBalance)
} }
// Compute the height preceding that which will cause the htlc CLTV // Compute the height preceding that which will cause the htlc CLTV