From a6f0dd72ac4d2a1edda9cb4a4db8c723b425525a Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Thu, 19 Apr 2018 13:05:50 +0200 Subject: [PATCH] contractcourt/chain_arbitrator: use chainWatcherConfig --- contractcourt/chain_arbitrator.go | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/contractcourt/chain_arbitrator.go b/contractcourt/chain_arbitrator.go index 95bc071ca..50500b74b 100644 --- a/contractcourt/chain_arbitrator.go +++ b/contractcourt/chain_arbitrator.go @@ -327,10 +327,16 @@ func (c *ChainArbitrator) Start() error { // First, we'll create an active chainWatcher for this channel // to ensure that we detect any relevant on chain events. chainWatcher, err := newChainWatcher( - channel, c.cfg.Notifier, c.cfg.PreimageDB, c.cfg.Signer, - c.cfg.IsOurAddress, func() error { - // TODO(roasbeef): also need to pass in log? - return c.resolveContract(chanPoint, nil) + chainWatcherConfig{ + chanState: channel, + notifier: c.cfg.Notifier, + 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 { @@ -654,9 +660,15 @@ func (c *ChainArbitrator) WatchNewChannel(newChan *channeldb.OpenChannel) error // First, also create an active chainWatcher for this channel to ensure // that we detect any relevant on chain events. chainWatcher, err := newChainWatcher( - newChan, c.cfg.Notifier, c.cfg.PreimageDB, c.cfg.Signer, - c.cfg.IsOurAddress, func() error { - return c.resolveContract(chanPoint, nil) + chainWatcherConfig{ + chanState: newChan, + 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 {