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.
This commit is contained in:
Joost Jager 2018-09-12 16:46:28 +02:00
parent 55aee9c703
commit ca619bf680
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
2 changed files with 12 additions and 10 deletions

@ -534,11 +534,18 @@ func (u *utxoNursery) NurseryReport(
case input.CommitmentTimeLock: case input.CommitmentTimeLock:
report.AddLimboCommitment(&kid) report.AddLimboCommitment(&kid)
// An HTLC output on our commitment transaction
// where the second-layer transaction hasn't
// yet confirmed.
case input.HtlcAcceptedSuccessSecondLevel: case input.HtlcAcceptedSuccessSecondLevel:
// An HTLC output on our commitment transaction
// where the second-layer transaction hasn't
// yet confirmed.
report.AddLimboStage1SuccessHtlc(&kid) 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): 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 // AddLimboDirectHtlc adds a direct HTLC on the commitment transaction of the
// remote party to the maturity report. This a CLTV time-locked output that // 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) { func (c *contractMaturityReport) AddLimboDirectHtlc(kid *kidOutput) {
c.limboBalance += kid.Amount() c.limboBalance += kid.Amount()

@ -664,12 +664,7 @@ func incubateTestOutput(t *testing.T, nursery *utxoNursery,
if onLocalCommitment { if onLocalCommitment {
expectedStage = 1 expectedStage = 1
} }
assertNurseryReport(t, nursery, 1, expectedStage, 10000)
// TODO(joostjager): Nursery is currently not reporting this limbo
// balance.
if onLocalCommitment {
assertNurseryReport(t, nursery, 1, expectedStage, 10000)
}
return outgoingRes return outgoingRes
} }