breacharbiter: utilize new channel on-chain event stream to watch for breaches

In this commit, we modify the breach arbiter to no longer require
holding a channel object directly in order to receive new notifications
about possible breaches. Instead, we’ll contact the chain arbiter to
request a new channel event subscription.

As a result of the new architecture, we no longer need to receive a
handoff once the new channel comes online, as the chainWatcher will
always be active and watching the channel until it’s been closed.
This commit is contained in:
Olaoluwa Osuntokun
2018-01-18 14:06:38 -08:00
parent defa1bc3e3
commit a0cc1d1b2d
2 changed files with 43 additions and 110 deletions

View File

@@ -409,20 +409,11 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
GenSweepScript: func() ([]byte, error) {
return newSweepPkScript(cc.wallet)
},
Notifier: cc.chainNotifier,
PublishTransaction: cc.wallet.PublishTransaction,
Signer: cc.wallet.Cfg.Signer,
Store: newRetributionStore(chanDB),
UpdateCloseSignal: func(op *wire.OutPoint,
ucs chan *lnwallet.UnilateralCloseSummary) error {
signals := &contractcourt.ContractSignals{
HtlcUpdates: make(chan []channeldb.HTLC),
UniCloseSignal: ucs,
}
return s.chainArb.UpdateContractSignals(*op, signals)
},
Notifier: cc.chainNotifier,
PublishTransaction: cc.wallet.PublishTransaction,
SubscribeChannelEvents: s.chainArb.SubscribeChannelEvents,
Signer: cc.wallet.Cfg.Signer,
Store: newRetributionStore(chanDB),
})
// Create the connection manager which will be responsible for