From 530c49f12ecbe2d00b718e7d824b53f85d653e2a Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 23 Nov 2017 13:39:04 -0600 Subject: [PATCH] funding: sent channel to breachArbiter as soon as it's open --- fundingmanager.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fundingmanager.go b/fundingmanager.go index a15456c1..d2c670c0 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -1718,6 +1718,16 @@ func (f *fundingManager) handleFundingLocked(fmsg *fundingLockedMsg) { fndgLog.Infof("Received duplicate fundingLocked for "+ "ChannelID(%v), ignoring.", chanID) channel.Stop() + channel.CancelObserver() + return + } + + // With the channel retrieved, we'll send the breach arbiter the new + // channel so it can watch for attempts to breach the channel's + // contract by the remote party. + select { + case f.cfg.ArbiterChan <- channel: + case <-f.quit: return } @@ -1731,15 +1741,6 @@ func (f *fundingManager) handleFundingLocked(fmsg *fundingLockedMsg) { return } - // With the channel retrieved, we'll send the breach arbiter the new - // channel so it can watch for attempts to breach the channel's - // contract by the remote party. - select { - case f.cfg.ArbiterChan <- channel: - case <-f.quit: - return - } - // Launch a defer so we _ensure_ that the channel barrier is properly // closed even if the target peer is not longer online at this point. defer func() {