From ca619bf680bd3054201c3cb2d9e12b36c670cd21 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Wed, 12 Sep 2018 16:46:28 +0200 Subject: [PATCH] utxonursery: report unconfirmed htlc on commit tx This commit closes a reporting gap for htlc outputs on the remote commitment tx. Those are waited out by nursery, but were not reported before. --- utxonursery.go | 15 +++++++++++---- utxonursery_test.go | 7 +------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/utxonursery.go b/utxonursery.go index 74868bdb..26068558 100644 --- a/utxonursery.go +++ b/utxonursery.go @@ -534,11 +534,18 @@ func (u *utxoNursery) NurseryReport( case input.CommitmentTimeLock: report.AddLimboCommitment(&kid) - // An HTLC output on our commitment transaction - // where the second-layer transaction hasn't - // yet confirmed. case input.HtlcAcceptedSuccessSecondLevel: + // An HTLC output on our commitment transaction + // where the second-layer transaction hasn't + // yet confirmed. report.AddLimboStage1SuccessHtlc(&kid) + + case input.HtlcOfferedRemoteTimeout: + // This is an HTLC output on the + // commitment transaction of the remote + // party. We are waiting for the CLTV + // timelock expire. + report.AddLimboDirectHtlc(&kid) } case bytes.HasPrefix(k, kndrPrefix): @@ -1121,7 +1128,7 @@ func (c *contractMaturityReport) AddLimboStage1TimeoutHtlc(baby *babyOutput) { // AddLimboDirectHtlc adds a direct HTLC on the commitment transaction of the // remote party to the maturity report. This a CLTV time-locked output that -// hasn't yet expired. +// has or hasn't expired yet. func (c *contractMaturityReport) AddLimboDirectHtlc(kid *kidOutput) { c.limboBalance += kid.Amount() diff --git a/utxonursery_test.go b/utxonursery_test.go index 4da0a239..b300e4ad 100644 --- a/utxonursery_test.go +++ b/utxonursery_test.go @@ -664,12 +664,7 @@ func incubateTestOutput(t *testing.T, nursery *utxoNursery, if onLocalCommitment { expectedStage = 1 } - - // TODO(joostjager): Nursery is currently not reporting this limbo - // balance. - if onLocalCommitment { - assertNurseryReport(t, nursery, 1, expectedStage, 10000) - } + assertNurseryReport(t, nursery, 1, expectedStage, 10000) return outgoingRes }