@@ -261,12 +261,7 @@ trait ChannelOpenSingleFunder extends FundingHandlers with ErrorHandlers {
261261 blockchain ! WatchFundingConfirmed (self, commitInput.outPoint.txid, fundingMinDepth)
262262 goto(WAIT_FOR_FUNDING_CONFIRMED ) using DATA_WAIT_FOR_FUNDING_CONFIRMED (commitments, None , nodeParams.currentBlockHeight, None , Right (fundingSigned)) storing() sending fundingSigned
263263 case None =>
264- blockchain ! WatchFundingLost (self, commitments.commitInput.outPoint.txid, nodeParams.channelConf.minDepthBlocks)
265- val channelKeyPath = keyManager.keyPath(commitments.localParams, commitments.channelConfig)
266- val nextPerCommitmentPoint = keyManager.commitmentPoint(channelKeyPath, 1 )
267- val shortIds = ShortIds (RealScidStatus .Unknown , ShortChannelId .generateLocalAlias(), None )
268- context.system.eventStream.publish(ShortChannelIdAssigned (self, d.channelId, shortIds, remoteNodeId))
269- val channelReady = ChannelReady (d.channelId, nextPerCommitmentPoint, TlvStream (ChannelReadyTlv .ShortChannelIdTlv (shortIds.localAlias)))
264+ val (shortIds, channelReady) = skipFundingConfirmation(commitments, None , emitEvent = true )
270265 goto(WAIT_FOR_CHANNEL_READY ) using DATA_WAIT_FOR_CHANNEL_READY (commitments, shortIds, channelReady) storing() sending Seq (fundingSigned, channelReady)
271266 }
272267 }
@@ -326,15 +321,9 @@ trait ChannelOpenSingleFunder extends FundingHandlers with ErrorHandlers {
326321 Funding .minDepthFunder(commitments.channelFeatures) match {
327322 case Some (fundingMinDepth) =>
328323 blockchain ! WatchFundingConfirmed (self, commitInput.outPoint.txid, fundingMinDepth)
329- log.info(s " committing txid= ${fundingTx.txid}" )
330324 goto(WAIT_FOR_FUNDING_CONFIRMED ) using DATA_WAIT_FOR_FUNDING_CONFIRMED (commitments, Some (fundingTx), blockHeight, None , Left (fundingCreated)) storing() calling publishFundingTx()
331325 case None =>
332- blockchain ! WatchFundingLost (self, commitments.commitInput.outPoint.txid, nodeParams.channelConf.minDepthBlocks)
333- val channelKeyPath = keyManager.keyPath(commitments.localParams, commitments.channelConfig)
334- val nextPerCommitmentPoint = keyManager.commitmentPoint(channelKeyPath, 1 )
335- val shortIds = ShortIds (RealScidStatus .Unknown , ShortChannelId .generateLocalAlias(), None )
336- context.system.eventStream.publish(ShortChannelIdAssigned (self, d.channelId, shortIds, remoteNodeId))
337- val channelReady = ChannelReady (d.channelId, nextPerCommitmentPoint, TlvStream (ChannelReadyTlv .ShortChannelIdTlv (shortIds.localAlias)))
326+ val (shortIds, channelReady) = skipFundingConfirmation(commitments, None , emitEvent = true )
338327 goto(WAIT_FOR_CHANNEL_READY ) using DATA_WAIT_FOR_CHANNEL_READY (commitments, shortIds, channelReady) storing() sending channelReady calling publishFundingTx()
339328 }
340329 }
@@ -368,14 +357,10 @@ trait ChannelOpenSingleFunder extends FundingHandlers with ErrorHandlers {
368357 case Event (remoteChannelReady : ChannelReady , d : DATA_WAIT_FOR_FUNDING_CONFIRMED ) =>
369358 if (remoteChannelReady.alias_opt.isDefined && d.commitments.localParams.isInitiator) {
370359 log.info(" this chanel isn't zero-conf, but we are funder and they sent an early channel_ready with an alias: no need to wait for confirmations" )
371- // NB: we will receive a WatchFundingConfirmedTriggered that will simply be ignored
372- blockchain ! WatchFundingLost (self, d.commitments.commitInput.outPoint.txid, nodeParams.channelConf.minDepthBlocks)
373- val channelKeyPath = keyManager.keyPath(d.commitments.localParams, d.commitments.channelConfig)
374- val nextPerCommitmentPoint = keyManager.commitmentPoint(channelKeyPath, 1 )
375360 // No need to emit ShortChannelIdAssigned: we will emit it when handling their channel_ready in WAIT_FOR_CHANNEL_READY
376- val shortIds = ShortIds (RealScidStatus .Unknown , ShortChannelId .generateLocalAlias(), remoteChannelReady.alias_opt)
377- val localChannelReady = ChannelReady (d.channelId, nextPerCommitmentPoint, TlvStream (ChannelReadyTlv .ShortChannelIdTlv (shortIds.localAlias)))
361+ val (shortIds, localChannelReady) = skipFundingConfirmation(d.commitments, remoteChannelReady.alias_opt, emitEvent = false )
378362 self ! remoteChannelReady
363+ // NB: we will receive a WatchFundingConfirmedTriggered later that will simply be ignored
379364 goto(WAIT_FOR_CHANNEL_READY ) using DATA_WAIT_FOR_CHANNEL_READY (d.commitments, shortIds, localChannelReady) storing() sending localChannelReady
380365 } else {
381366 log.info(" received their channel_ready, deferring message" )
0 commit comments