Skip to content

Commit

Permalink
utxonursery: ensure we don't attempt to create negative value'd outputs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Roasbeef committed Jan 18, 2017
1 parent 9662887 commit 1cbdf64
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utxonursery.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1cbdf64

Please sign in to comment.