Skip to content

Commit

Permalink
contractcourt: make sure launchResolvers is called on new blockbeat
Browse files Browse the repository at this point in the history
This is an oversight from addressing this commment:
#9277 (comment)

where we should focus on skipping the close events but not the
resolvers.
  • Loading branch information
yyforyongyu committed Dec 20, 2024
1 parent 9efe075 commit ffbf071
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions contractcourt/channel_arbitrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2994,12 +2994,18 @@ func (c *ChannelArbitrator) handleBlockbeat(beat chainio.Blockbeat) error {

// If the state is StateContractClosed, StateWaitingFullResolution, or
// StateFullyResolved, there's no need to read the close event channel
// and launch the resolvers since the arbitrator can only get to this
// state after processing a previous close event and launched all its
// resolvers.
// since the arbitrator can only get to this state after processing a
// previous close event and launched all its resolvers.
if c.state.IsContractClosed() {
log.Infof("ChannelArbitrator(%v): skipping launching "+
"resolvers in state=%v", c.cfg.ChanPoint, c.state)
log.Infof("ChannelArbitrator(%v): skipping reading close "+
"events in state=%v", c.cfg.ChanPoint, c.state)

// Launch all active resolvers when a new blockbeat is
// received, even when the contract is closed, we still need
// this as the resolvers may transform into new ones. For
// already launched resolvers this will be NOOP as they track
// their own `launched` states.
c.launchResolvers()

return nil
}
Expand Down

0 comments on commit ffbf071

Please sign in to comment.