diff --git a/contractcourt/channel_arbitrator.go b/contractcourt/channel_arbitrator.go index 80088d73..7aeb2e35 100644 --- a/contractcourt/channel_arbitrator.go +++ b/contractcourt/channel_arbitrator.go @@ -1214,26 +1214,10 @@ func (c *ChannelArbitrator) checkChainActions(height uint32, // either learn of it eventually from the outgoing HTLC, or the sender // will timeout the HTLC. for _, htlc := range c.activeHTLCs.incomingHTLCs { - // If we have the pre-image, then we should go on-chain to - // redeem the HTLC immediately. - if _, ok := c.cfg.PreimageDB.LookupPreimage(htlc.RHash); ok { - log.Tracef("ChannelArbitrator(%v): preimage for "+ - "htlc=%x is known!", c.cfg.ChanPoint, - htlc.RHash[:]) - - actionMap[HtlcClaimAction] = append( - actionMap[HtlcClaimAction], htlc, - ) - continue - } - log.Tracef("ChannelArbitrator(%v): watching chain to decide "+ "action for incoming htlc=%x", c.cfg.ChanPoint, htlc.RHash[:]) - // Otherwise, we don't yet have the pre-image, but should watch - // on-chain to see if either: the remote party times out the - // HTLC, or we learn of the pre-image. actionMap[HtlcIncomingWatchAction] = append( actionMap[HtlcIncomingWatchAction], htlc, ) diff --git a/contractcourt/htlc_incoming_contest_resolver.go b/contractcourt/htlc_incoming_contest_resolver.go index 4f2d16ba..8889484e 100644 --- a/contractcourt/htlc_incoming_contest_resolver.go +++ b/contractcourt/htlc_incoming_contest_resolver.go @@ -57,8 +57,11 @@ func (h *htlcIncomingContestResolver) Resolve() (ContractResolver, error) { return nil, err } - // If we're past the point of expiry of the HTLC, then at this point - // the sender can sweep it, so we'll end our lifetime. + // If we're past the point of expiry of the HTLC, then at this point the + // sender can sweep it, so we'll end our lifetime. Here we deliberately + // forego the chance that the sender doesn't sweep and we already have + // or will learn the preimage. Otherwise the resolver could potentially + // stay active indefinitely and the channel will never close properly. if uint32(currentHeight) >= h.htlcExpiry { // TODO(roasbeef): should also somehow check if outgoing is // resolved or not