From a5b9279ca132124bf5ac4076fd765c6e915055fa Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Sun, 26 Aug 2018 19:55:38 -0700 Subject: [PATCH] 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. --- lnd_test.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lnd_test.go b/lnd_test.go index e8236f24..11b99934 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -2411,15 +2411,22 @@ func testChannelForceClosure(net *lntest.NetworkHarness, t *harnessTest) { t.Fatalf(err.Error()) } - // The htlc funds will still be shown as limbo, since they are still in - // their first stage. The commitment funds will have been recovered - // after the commit txn was included in the last block. + // The commitment funds will have been recovered after the commit txn + // was included in the last block. The htlc funds will not be shown in + // 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) if err != nil { t.Fatalf(err.Error()) } - if forceClose.LimboBalance == 0 { - t.Fatalf("htlc funds should still be in limbo") + err = checkPendingChannelNumHtlcs(forceClose, 0) + 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