contractcourt: make sure launchResolvers is called on new blockbeat
This is an oversight from addressing this commment: https://github.com/lightningnetwork/lnd/pull/9277#discussion_r1882410396 where we should focus on skipping the close events but not the resolvers.
This commit is contained in:
1 file changed
+11
-5
@@ -2994,12 +2994,18 @@ func (c *ChannelArbitrator) handleBlockbeat(beat chainio.Blockbeat) error {
|
|||||||
|
|
||||||
// If the state is StateContractClosed, StateWaitingFullResolution, or
|
// If the state is StateContractClosed, StateWaitingFullResolution, or
|
||||||
// StateFullyResolved, there's no need to read the close event channel
|
// StateFullyResolved, there's no need to read the close event channel
|
||||||
// and launch the resolvers since the arbitrator can only get to this
|
// since the arbitrator can only get to this state after processing a
|
||||||
// state after processing a previous close event and launched all its
|
// previous close event and launched all its resolvers.
|
||||||
// resolvers.
|
|
||||||
if c.state.IsContractClosed() {
|
if c.state.IsContractClosed() {
|
||||||
log.Infof("ChannelArbitrator(%v): skipping launching "+
|
log.Infof("ChannelArbitrator(%v): skipping reading close "+
|
||||||
"resolvers in state=%v", c.cfg.ChanPoint, c.state)
|
"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
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user