contractcourt: make synchronous chain watcher notifications optional
In this commit, we modify the way that notifications are dispatched within the chainWatcher. Before we would *always* wait for an ack back before we started to clean up he database state. This would at times lead to deadlocks. To remedy this, we now allow callers to decide if they want notifications to be sync or not. The only current caller that requires this is the breach arbiter.
This commit is contained in:
5 files changed
+57
-31
No files matched your search
@@ -417,11 +417,16 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
|
||||
GenSweepScript: func() ([]byte, error) {
|
||||
return newSweepPkScript(cc.wallet)
|
||||
},
|
||||
Notifier: cc.chainNotifier,
|
||||
PublishTransaction: cc.wallet.PublishTransaction,
|
||||
SubscribeChannelEvents: s.chainArb.SubscribeChannelEvents,
|
||||
Signer: cc.wallet.Cfg.Signer,
|
||||
Store: newRetributionStore(chanDB),
|
||||
Notifier: cc.chainNotifier,
|
||||
PublishTransaction: cc.wallet.PublishTransaction,
|
||||
SubscribeChannelEvents: func(chanPoint wire.OutPoint) (*contractcourt.ChainEventSubscription, error) {
|
||||
// We'll request a sync dispatch to ensure that the channel
|
||||
// is only marked as closed *after* we update our internal
|
||||
// state.
|
||||
return s.chainArb.SubscribeChannelEvents(chanPoint, true)
|
||||
},
|
||||
Signer: cc.wallet.Cfg.Signer,
|
||||
Store: newRetributionStore(chanDB),
|
||||
})
|
||||
|
||||
// Create the connection manager which will be responsible for
|
||||
|
||||
Reference in new issue
Block a user