breacharbiter: stop the stale contract when a live contract appears
This commit modifies the logic of the contract hand-off within the breachArbiter to ensure that only a single internal closeObserver goroutine is ever active for a given contract. This modification cleans up the logs in the case of multiple reconnections and may possible eliminate some non-deterministic bugs related to channel force closures.
This commit is contained in:
parent
62bcd59db4
commit
2c0d5e0f0d
@ -106,8 +106,8 @@ func (b *breachArbiter) Start() error {
|
||||
channelsToWatch := make([]*lnwallet.LightningChannel,
|
||||
len(activeChannels))
|
||||
for i, chanState := range activeChannels {
|
||||
channel, err := lnwallet.NewLightningChannel(nil, nil,
|
||||
b.notifier, chanState)
|
||||
channel, err := lnwallet.NewLightningChannel(nil, b.notifier,
|
||||
chanState)
|
||||
if err != nil {
|
||||
brarLog.Errorf("unable to load channel from disk")
|
||||
return err
|
||||
@ -357,6 +357,7 @@ func (b *breachArbiter) breachObserver(contract *lnwallet.LightningChannel,
|
||||
// A read from this channel indicates that the contract has been
|
||||
// settled cooperatively so we exit as our duties are no longer needed.
|
||||
case <-settleSignal:
|
||||
contract.Stop()
|
||||
return
|
||||
|
||||
// A read from this channel indicates that a channel breach has been
|
||||
|
Loading…
Reference in New Issue
Block a user