mirror of https://github.com/BTCPrivate/lnd.git
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,
|
channelsToWatch := make([]*lnwallet.LightningChannel,
|
||||||
len(activeChannels))
|
len(activeChannels))
|
||||||
for i, chanState := range activeChannels {
|
for i, chanState := range activeChannels {
|
||||||
channel, err := lnwallet.NewLightningChannel(nil, nil,
|
channel, err := lnwallet.NewLightningChannel(nil, b.notifier,
|
||||||
b.notifier, chanState)
|
chanState)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
brarLog.Errorf("unable to load channel from disk")
|
brarLog.Errorf("unable to load channel from disk")
|
||||||
return err
|
return err
|
||||||
|
@ -357,6 +357,7 @@ func (b *breachArbiter) breachObserver(contract *lnwallet.LightningChannel,
|
||||||
// A read from this channel indicates that the contract has been
|
// A read from this channel indicates that the contract has been
|
||||||
// settled cooperatively so we exit as our duties are no longer needed.
|
// settled cooperatively so we exit as our duties are no longer needed.
|
||||||
case <-settleSignal:
|
case <-settleSignal:
|
||||||
|
contract.Stop()
|
||||||
return
|
return
|
||||||
|
|
||||||
// A read from this channel indicates that a channel breach has been
|
// A read from this channel indicates that a channel breach has been
|
||||||
|
|
Loading…
Reference in New Issue