@@ -86,7 +86,8 @@ object Channel {
8686 minFundingPrivateSatoshis : Satoshi ,
8787 toRemoteDelay : CltvExpiryDelta ,
8888 maxToLocalDelay : CltvExpiryDelta ,
89- minDepthBlocks : Int ,
89+ minDepthFunding : Int ,
90+ minDepthClosing : Int ,
9091 expiryDelta : CltvExpiryDelta ,
9192 maxExpiryDelta : CltvExpiryDelta ,
9293 fulfillSafetyBeforeTimeout : CltvExpiryDelta ,
@@ -294,11 +295,11 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
294295 watchFundingConfirmed(commitment.fundingTxId, Some (singleFundingMinDepth(data)), herdDelay_opt)
295296 case fundingTx : LocalFundingStatus .DualFundedUnconfirmedFundingTx =>
296297 publishFundingTx(fundingTx)
297- val minDepth_opt = data.commitments.params.minDepthDualFunding(nodeParams.channelConf.minDepthBlocks , fundingTx.sharedTx.tx)
298+ val minDepth_opt = data.commitments.params.minDepthDualFunding(nodeParams.channelConf.minDepthFunding , fundingTx.sharedTx.tx)
298299 watchFundingConfirmed(fundingTx.sharedTx.txId, minDepth_opt, herdDelay_opt)
299300 case fundingTx : LocalFundingStatus .ZeroconfPublishedFundingTx =>
300301 // those are zero-conf channels, the min-depth isn't critical, we use the default
301- watchFundingConfirmed(fundingTx.tx.txid, Some (nodeParams.channelConf.minDepthBlocks .toLong), herdDelay_opt)
302+ watchFundingConfirmed(fundingTx.tx.txid, Some (nodeParams.channelConf.minDepthFunding .toLong), herdDelay_opt)
302303 case _ : LocalFundingStatus .ConfirmedFundingTx =>
303304 data match {
304305 case closing : DATA_CLOSING if Closing .nothingAtStake(closing) || Closing .isClosingTypeAlreadyKnown(closing).isDefined =>
@@ -581,7 +582,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
581582 // We don't have their tx_sigs, but they have ours, and could publish the funding tx without telling us.
582583 // That's why we move on immediately to the next step, and will update our unsigned funding tx when we
583584 // receive their tx_sigs.
584- val minDepth_opt = d.commitments.params.minDepthDualFunding(nodeParams.channelConf.minDepthBlocks , signingSession1.fundingTx.sharedTx.tx)
585+ val minDepth_opt = d.commitments.params.minDepthDualFunding(nodeParams.channelConf.minDepthFunding , signingSession1.fundingTx.sharedTx.tx)
585586 watchFundingConfirmed(signingSession.fundingTx.txId, minDepth_opt, delay_opt = None )
586587 val commitments1 = d.commitments.add(signingSession1.commitment)
587588 val d1 = d.copy(commitments = commitments1, spliceStatus = SpliceStatus .NoSplice )
@@ -1316,7 +1317,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
13161317 rollbackFundingAttempt(signingSession.fundingTx.tx, previousTxs = Seq .empty) // no splice rbf yet
13171318 stay() using d.copy(spliceStatus = SpliceStatus .SpliceAborted ) sending TxAbort (d.channelId, f.getMessage)
13181319 case Right (signingSession1) =>
1319- val minDepth_opt = d.commitments.params.minDepthDualFunding(nodeParams.channelConf.minDepthBlocks , signingSession1.fundingTx.sharedTx.tx)
1320+ val minDepth_opt = d.commitments.params.minDepthDualFunding(nodeParams.channelConf.minDepthFunding , signingSession1.fundingTx.sharedTx.tx)
13201321 watchFundingConfirmed(signingSession.fundingTx.txId, minDepth_opt, delay_opt = None )
13211322 val commitments1 = d.commitments.add(signingSession1.commitment)
13221323 val d1 = d.copy(commitments = commitments1, spliceStatus = SpliceStatus .NoSplice )
@@ -1335,7 +1336,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
13351336 val fundingStatus = LocalFundingStatus .ZeroconfPublishedFundingTx (w.tx, d.commitments.localFundingSigs(w.tx.txid), d.commitments.liquidityPurchase(w.tx.txid))
13361337 d.commitments.updateLocalFundingStatus(w.tx.txid, fundingStatus) match {
13371338 case Right ((commitments1, _)) =>
1338- watchFundingConfirmed(w.tx.txid, Some (nodeParams.channelConf.minDepthBlocks ), delay_opt = None )
1339+ watchFundingConfirmed(w.tx.txid, Some (nodeParams.channelConf.minDepthFunding ), delay_opt = None )
13391340 maybeEmitEventsPostSplice(d.shortIds, d.commitments, commitments1)
13401341 maybeUpdateMaxHtlcAmount(d.channelUpdate.htlcMaximumMsat, commitments1)
13411342 stay() using d.copy(commitments = commitments1) storing() sending SpliceLocked (d.channelId, w.tx.txid)
@@ -1802,8 +1803,8 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
18021803 } else {
18031804 d.commitments.resolveCommitment(tx) match {
18041805 case Some (commitment) =>
1805- log.warning(s " a commit tx for an older commitment has been published fundingTxId= ${tx.txid } fundingTxIndex= ${ commitment.fundingTxIndex} " )
1806- blockchain ! WatchAlternativeCommitTxConfirmed (self, tx.txid, nodeParams.channelConf.minDepthBlocks )
1806+ log.warning(" a commit tx for an older commitment has been published fundingTxId={ } fundingTxIndex={} " , tx.txid, commitment.fundingTxIndex)
1807+ blockchain ! WatchAlternativeCommitTxConfirmed (self, tx.txid, nodeParams.channelConf.minDepthClosing )
18071808 stay()
18081809 case None =>
18091810 // This must be a former funding tx that has already been pruned, because watches are unordered.
@@ -1872,7 +1873,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
18721873 case Event (WatchOutputSpentTriggered (tx), d : DATA_CLOSING ) =>
18731874 // one of the outputs of the local/remote/revoked commit was spent
18741875 // we just put a watch to be notified when it is confirmed
1875- blockchain ! WatchTxConfirmed (self, tx.txid, nodeParams.channelConf.minDepthBlocks )
1876+ blockchain ! WatchTxConfirmed (self, tx.txid, nodeParams.channelConf.minDepthClosing )
18761877 // when a remote or local commitment tx containing outgoing htlcs is published on the network,
18771878 // we watch it in order to extract payment preimage if funds are pulled by the counterparty
18781879 // we can then use these preimages to fulfill origin htlcs
@@ -1907,7 +1908,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
19071908 val (localCommitPublished1, claimHtlcTx_opt) = Closing .LocalClose .claimHtlcDelayedOutput(localCommitPublished, keyManager, d.commitments.latest, tx, nodeParams.currentBitcoinCoreFeerates, nodeParams.onChainFeeConf, d.finalScriptPubKey)
19081909 claimHtlcTx_opt.foreach(claimHtlcTx => {
19091910 txPublisher ! PublishFinalTx (claimHtlcTx, claimHtlcTx.fee, None )
1910- blockchain ! WatchTxConfirmed (self, claimHtlcTx.tx.txid, nodeParams.channelConf.minDepthBlocks , Some (RelativeDelay (tx.txid, d.commitments.params.remoteParams.toSelfDelay.toInt.toLong)))
1911+ blockchain ! WatchTxConfirmed (self, claimHtlcTx.tx.txid, nodeParams.channelConf.minDepthClosing , Some (RelativeDelay (tx.txid, d.commitments.params.remoteParams.toSelfDelay.toInt.toLong)))
19111912 })
19121913 Closing .updateLocalCommitPublished(localCommitPublished1, tx)
19131914 }),
@@ -2490,8 +2491,8 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
24902491 val fundingStatus = LocalFundingStatus .ZeroconfPublishedFundingTx (w.tx, d.commitments.localFundingSigs(w.tx.txid), d.commitments.liquidityPurchase(w.tx.txid))
24912492 d.commitments.updateLocalFundingStatus(w.tx.txid, fundingStatus) match {
24922493 case Right ((commitments1, _)) =>
2493- log.info(s " zero-conf funding txid= ${w.tx.txid } has been published " )
2494- watchFundingConfirmed(w.tx.txid, Some (nodeParams.channelConf.minDepthBlocks ), delay_opt = None )
2494+ log.info(" zero-conf funding txid={ } has been published" , w.tx.txid )
2495+ watchFundingConfirmed(w.tx.txid, Some (nodeParams.channelConf.minDepthFunding ), delay_opt = None )
24952496 val d1 = d match {
24962497 // NB: we discard remote's stashed channel_ready, they will send it back at reconnection
24972498 case d : DATA_WAIT_FOR_FUNDING_CONFIRMED =>
@@ -2566,9 +2567,9 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
25662567 } else {
25672568 d.commitments.resolveCommitment(tx) match {
25682569 case Some (commitment) =>
2569- log.warning(s " a commit tx for an older commitment has been published fundingTxId= ${tx.txid } fundingTxIndex= ${ commitment.fundingTxIndex} " )
2570+ log.warning(" a commit tx for an older commitment has been published fundingTxId={ } fundingTxIndex={} " , tx.txid, commitment.fundingTxIndex)
25702571 // we watch the commitment tx, in the meantime we force close using the latest commitment
2571- blockchain ! WatchAlternativeCommitTxConfirmed (self, tx.txid, nodeParams.channelConf.minDepthBlocks )
2572+ blockchain ! WatchAlternativeCommitTxConfirmed (self, tx.txid, nodeParams.channelConf.minDepthClosing )
25722573 spendLocalCurrent(d)
25732574 case None =>
25742575 // This must be a former funding tx that has already been pruned, because watches are unordered.
0 commit comments