utxonursery: ensure we don't attempt to create negative value'd outputs

This commit fixes a slight bug in the utxoNursery. Previously, if we
forced closed a channel that was solely funded by the other party
without pushing any satoshis, then the utxoNursery would attempt to
sweep a target output even though it didn’t actually exist. This would
result in the creation of a negative value’d output due to the hard
coded fees currently used in several areas.

To fix his, we now ignore any “output” with a value of zero, when
adding new outputs to the kindergarden bucket.
This commit is contained in:
Olaoluwa Osuntokun 2017-01-17 16:21:51 -08:00
parent 9662887d2f
commit 1cbdf6473f
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -314,6 +314,13 @@ out:
len(preschoolRequest.outputs))
for _, output := range preschoolRequest.outputs {
// We'll skip any zero value'd outputs as this
// indicates we don't have a settled balance
// within the commitment transaction.
if output.amt == 0 {
continue
}
sourceTxid := output.outPoint.Hash
if err := output.enterPreschool(u.db); err != nil {