breacharbiter: fix double channel close panic bug

This commit fixes s bug in the breachArbiter which was introduced
during the change that added the live channel hand off from an active
peer. Rather than closing the settle channel of the _older_
breachObserver, the settle channel of the newer beachObserver was being
closed. This would result in a panic once the channel itself was
actually settled as the channel would be closed again.

To fix this bug, we now properly close the channel of the old settle
signal instead of the new one.
This commit is contained in:
Olaoluwa Osuntokun 2016-12-30 16:28:20 -08:00
parent 0585ed93be
commit 276c384455
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

View File

@ -191,11 +191,11 @@ out:
// the contract. So we'll cancel active watcher
// goroutine to create a new instance with the latest
// contract reference.
if _, ok := b.breachObservers[*chanPoint]; ok {
if oldSignal, ok := b.breachObservers[*chanPoint]; ok {
brarLog.Infof("ChannelPoint(%v) is now live, "+
"abandoning state contract for live "+
"version", chanPoint)
close(settleSignal)
close(oldSignal)
}
b.breachObservers[*chanPoint] = settleSignal