From 327420d854580a0e430831a33fbcdb6d28f20df8 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 19 Jun 2018 12:20:30 +0100 Subject: [PATCH] contractcourt/channel_arbitrator: Cancel block epoch in case of error in Start() --- contractcourt/channel_arbitrator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contractcourt/channel_arbitrator.go b/contractcourt/channel_arbitrator.go index 0ee68313..ac7cdb1a 100644 --- a/contractcourt/channel_arbitrator.go +++ b/contractcourt/channel_arbitrator.go @@ -231,6 +231,7 @@ func (c *ChannelArbitrator) Start() error { // machine can act accordingly. c.state, err = c.log.CurrentState() if err != nil { + c.cfg.BlockEpochs.Cancel() return err } @@ -239,6 +240,7 @@ func (c *ChannelArbitrator) Start() error { _, bestHeight, err := c.cfg.ChainIO.GetBestBlock() if err != nil { + c.cfg.BlockEpochs.Cancel() return err } @@ -249,6 +251,7 @@ func (c *ChannelArbitrator) Start() error { uint32(bestHeight), chainTrigger, nil, ) if err != nil { + c.cfg.BlockEpochs.Cancel() return err } @@ -262,6 +265,7 @@ func (c *ChannelArbitrator) Start() error { // relaunch all contract resolvers. unresolvedContracts, err = c.log.FetchUnresolvedContracts() if err != nil { + c.cfg.BlockEpochs.Cancel() return err }