@@ -1349,7 +1349,7 @@ object Helpers {
13491349 // a valid tx will always have at least one input, but this ensures we don't throw in tests
13501350 val sequence = commitTx.txIn.headOption.map(_.sequence).getOrElse(0L )
13511351 val obscuredTxNumber = Transactions .decodeTxNumber(sequence, commitTx.lockTime)
1352- val localPaymentPoint = params.localParams.walletStaticPaymentBasepoint.getOrElse( channelKeys.paymentBasePoint)
1352+ val localPaymentPoint = channelKeys.paymentBasePoint
13531353 // this tx has been published by remote, so we need to invert local/remote params
13541354 val txNumber = Transactions .obscuredCommitTxNumber(obscuredTxNumber, ! params.localParams.isChannelOpener, params.remoteParams.paymentBasepoint, localPaymentPoint)
13551355 if (txNumber > 0xffffffffffffL) {
@@ -1368,7 +1368,7 @@ object Helpers {
13681368 def claimCommitTxOutputs (channelParams : ChannelParams , channelKeys : ChannelKeys , commitTx : Transaction , commitmentNumber : Long , remotePerCommitmentSecret : PrivateKey , toSelfDelay : CltvExpiryDelta , commitmentFormat : CommitmentFormat , db : ChannelsDb , dustLimit : Satoshi , feerates : FeeratesPerKw , onChainFeeConf : OnChainFeeConf , finalScriptPubKey : ByteVector )(implicit log : LoggingAdapter ): (RevokedCommitPublished , SecondStageTransactions ) = {
13691369 log.warning(" a revoked commit has been published with commitmentNumber={}" , commitmentNumber)
13701370
1371- val commitKeys = RemoteCommitmentKeys (channelParams, channelKeys, remotePerCommitmentSecret.publicKey, commitmentFormat )
1371+ val commitKeys = RemoteCommitmentKeys (channelParams, channelKeys, remotePerCommitmentSecret.publicKey)
13721372 val revocationKey = channelKeys.revocationKey(remotePerCommitmentSecret)
13731373
13741374 val feerateMain = onChainFeeConf.getClosingFeerate(feerates, maxClosingFeerateOverride_opt = None )
@@ -1428,7 +1428,7 @@ object Helpers {
14281428 if (spendsHtlcOutput) {
14291429 getRemotePerCommitmentSecret(channelParams, channelKeys, remotePerCommitmentSecrets, revokedCommitPublished.commitTx).map {
14301430 case (_, remotePerCommitmentSecret) =>
1431- val commitmentKeys = RemoteCommitmentKeys (channelParams, channelKeys, remotePerCommitmentSecret.publicKey, commitmentFormat )
1431+ val commitmentKeys = RemoteCommitmentKeys (channelParams, channelKeys, remotePerCommitmentSecret.publicKey)
14321432 val revocationKey = channelKeys.revocationKey(remotePerCommitmentSecret)
14331433 val penaltyTxs = claimHtlcTxOutputs(commitmentKeys, revocationKey, toSelfDelay, commitmentFormat, htlcTx, dustLimit, feerates, finalScriptPubKey)
14341434 val revokedCommitPublished1 = revokedCommitPublished.copy(htlcDelayedOutputs = revokedCommitPublished.htlcDelayedOutputs ++ penaltyTxs.map(_.input.outPoint))
@@ -1452,7 +1452,7 @@ object Helpers {
14521452 * Claim the outputs of all 2nd-stage HTLC transactions that have been confirmed.
14531453 */
14541454 def claimHtlcTxsOutputs (channelParams : ChannelParams , channelKeys : ChannelKeys , remotePerCommitmentSecret : PrivateKey , toSelfDelay : CltvExpiryDelta , commitmentFormat : CommitmentFormat , revokedCommitPublished : RevokedCommitPublished , dustLimit : Satoshi , feerates : FeeratesPerKw , finalScriptPubKey : ByteVector )(implicit log : LoggingAdapter ): ThirdStageTransactions = {
1455- val commitmentKeys = RemoteCommitmentKeys (channelParams, channelKeys, remotePerCommitmentSecret.publicKey, commitmentFormat )
1455+ val commitmentKeys = RemoteCommitmentKeys (channelParams, channelKeys, remotePerCommitmentSecret.publicKey)
14561456 val revocationKey = channelKeys.revocationKey(remotePerCommitmentSecret)
14571457 val confirmedHtlcTxs = revokedCommitPublished.htlcOutputs.flatMap(htlcOutput => revokedCommitPublished.irrevocablySpent.get(htlcOutput))
14581458 val penaltyTxs = confirmedHtlcTxs.flatMap(htlcTx => claimHtlcTxOutputs(commitmentKeys, revocationKey, toSelfDelay, commitmentFormat, htlcTx, dustLimit, feerates, finalScriptPubKey))
@@ -1680,18 +1680,11 @@ object Helpers {
16801680 }
16811681
16821682 /** Returns the amount we've successfully claimed from a force-closed channel. */
1683- def closingBalance (channelParams : ChannelParams , commitmentFormat : CommitmentFormat , closingScript : ByteVector , commit : CommitPublished ): Satoshi = {
1684- val toLocal = commit.localOutput_opt match {
1685- case Some (o) if o.index < commit.commitTx.txOut.size => commit.commitTx.txOut(o.index.toInt).amount
1686- case _ => 0 sat
1687- }
1688- val toClosingScript = commit.irrevocablySpent.values.flatMap(_.txOut)
1683+ def closingBalance (closingScript : ByteVector , commit : CommitPublished ): Satoshi = {
1684+ commit.irrevocablySpent.values.flatMap(_.txOut)
16891685 .filter(_.publicKeyScript == closingScript)
16901686 .map(_.amount)
16911687 .sum
1692- commitmentFormat match {
1693- case _ : AnchorOutputsCommitmentFormat | _ : SimpleTaprootChannelCommitmentFormat => toClosingScript
1694- }
16951688 }
16961689
16971690 }
0 commit comments