From 1cbdf6473f968da61c8fed199d6d14eebf969929 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 17 Jan 2017 16:21:51 -0800 Subject: [PATCH] utxonursery: ensure we don't attempt to create negative value'd outputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- utxonursery.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utxonursery.go b/utxonursery.go index ea5f654c..8622cb89 100644 --- a/utxonursery.go +++ b/utxonursery.go @@ -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 {