contractcourt/chain_arbitrator: use chainWatcherConfig

This commit is contained in:
Johan T. Halseth 2018-04-19 13:05:50 +02:00
parent 0697510884
commit a6f0dd72ac
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -327,10 +327,16 @@ func (c *ChainArbitrator) Start() error {
// First, we'll create an active chainWatcher for this channel // First, we'll create an active chainWatcher for this channel
// to ensure that we detect any relevant on chain events. // to ensure that we detect any relevant on chain events.
chainWatcher, err := newChainWatcher( chainWatcher, err := newChainWatcher(
channel, c.cfg.Notifier, c.cfg.PreimageDB, c.cfg.Signer, chainWatcherConfig{
c.cfg.IsOurAddress, func() error { chanState: channel,
// TODO(roasbeef): also need to pass in log? notifier: c.cfg.Notifier,
return c.resolveContract(chanPoint, nil) pCache: c.cfg.PreimageDB,
signer: c.cfg.Signer,
isOurAddr: c.cfg.IsOurAddress,
markChanClosed: func() error {
// TODO(roasbeef): also need to pass in log?
return c.resolveContract(chanPoint, nil)
},
}, },
) )
if err != nil { if err != nil {
@ -654,9 +660,15 @@ func (c *ChainArbitrator) WatchNewChannel(newChan *channeldb.OpenChannel) error
// First, also create an active chainWatcher for this channel to ensure // First, also create an active chainWatcher for this channel to ensure
// that we detect any relevant on chain events. // that we detect any relevant on chain events.
chainWatcher, err := newChainWatcher( chainWatcher, err := newChainWatcher(
newChan, c.cfg.Notifier, c.cfg.PreimageDB, c.cfg.Signer, chainWatcherConfig{
c.cfg.IsOurAddress, func() error { chanState: newChan,
return c.resolveContract(chanPoint, nil) notifier: c.cfg.Notifier,
pCache: c.cfg.PreimageDB,
signer: c.cfg.Signer,
isOurAddr: c.cfg.IsOurAddress,
markChanClosed: func() error {
return c.resolveContract(chanPoint, nil)
},
}, },
) )
if err != nil { if err != nil {