@@ -169,8 +169,9 @@ case class LocalCommit(index: Long, spec: CommitmentSpec, txId: TxId, remoteSig:
169169object LocalCommit {
170170 def fromCommitSig (channelParams : ChannelParams , commitParams : CommitParams , commitKeys : LocalCommitmentKeys , fundingTxId : TxId ,
171171 fundingKey : PrivateKey , remoteFundingPubKey : PublicKey , commitInput : InputInfo ,
172- commit : CommitSig , localCommitIndex : Long , spec : CommitmentSpec , commitmentFormat : CommitmentFormat ): Either [ChannelException , LocalCommit ] = {
172+ commit : CommitSig , localCommitIndex : Long , spec : CommitmentSpec , commitmentFormat : CommitmentFormat )( implicit log : LoggingAdapter ) : Either [ChannelException , LocalCommit ] = {
173173 val (localCommitTx, htlcTxs) = Commitment .makeLocalTxs(channelParams, commitParams, commitKeys, localCommitIndex, fundingKey, remoteFundingPubKey, commitInput, commitmentFormat, spec)
174+ log.info(s " built local commit number= $localCommitIndex toLocalMsat= ${spec.toLocal.toLong} toRemoteMsat= ${spec.toRemote.toLong} htlc_in={} htlc_out={} feeratePerKw= ${spec.commitTxFeerate} txid= ${localCommitTx.tx.txid} fundingTxId= $fundingTxId" , spec.htlcs.collect(DirectedHtlc .incoming).map(_.id).mkString(" ," ), spec.htlcs.collect(DirectedHtlc .outgoing).map(_.id).mkString(" ," ))
174175 val remoteCommitSigOk = commitmentFormat match {
175176 case _ : SegwitV0CommitmentFormat => localCommitTx.checkRemoteSig(fundingKey.publicKey, remoteFundingPubKey, commit.signature)
176177 case _ : SimpleTaprootChannelCommitmentFormat => commit.sigOrPartialSig match {
@@ -200,12 +201,13 @@ object LocalCommit {
200201
201202/** The remote commitment maps to a commitment transaction that only our peer can sign and broadcast. */
202203case class RemoteCommit (index : Long , spec : CommitmentSpec , txId : TxId , remotePerCommitmentPoint : PublicKey ) {
203- def sign (channelParams : ChannelParams , commitParams : CommitParams , channelKeys : ChannelKeys , fundingTxIndex : Long , remoteFundingPubKey : PublicKey , commitInput : InputInfo , commitmentFormat : CommitmentFormat , remoteNonce_opt : Option [IndividualNonce ], batchSize : Int = 1 ): Either [ChannelException , CommitSig ] = {
204+ def sign (channelParams : ChannelParams , commitParams : CommitParams , channelKeys : ChannelKeys , fundingTxIndex : Long , remoteFundingPubKey : PublicKey , commitInput : InputInfo , commitmentFormat : CommitmentFormat , remoteNonce_opt : Option [IndividualNonce ], batchSize : Int = 1 )( implicit log : LoggingAdapter ) : Either [ChannelException , CommitSig ] = {
204205 val fundingKey = channelKeys.fundingKey(fundingTxIndex)
205206 val commitKeys = RemoteCommitmentKeys (channelParams, channelKeys, remotePerCommitmentPoint)
206207 val (remoteCommitTx, htlcTxs) = Commitment .makeRemoteTxs(channelParams, commitParams, commitKeys, index, fundingKey, remoteFundingPubKey, commitInput, commitmentFormat, spec)
207208 val sortedHtlcTxs = htlcTxs.sortBy(_.input.outPoint.index)
208209 val htlcSigs = sortedHtlcTxs.map(_.localSig(commitKeys))
210+ log.info(s " built remote commit number= $index toLocalMsat= ${spec.toLocal.toLong} toRemoteMsat= ${spec.toRemote.toLong} htlc_in={} htlc_out={} feeratePerKw= ${spec.commitTxFeerate} txid= ${remoteCommitTx.tx.txid} fundingTxId= ${commitInput.outPoint.txid}" , spec.htlcs.collect(DirectedHtlc .outgoing).map(_.id).mkString(" ," ), spec.htlcs.collect(DirectedHtlc .incoming).map(_.id).mkString(" ," ))
209211 commitmentFormat match {
210212 case _ : SegwitV0CommitmentFormat =>
211213 val sig = remoteCommitTx.sign(fundingKey, remoteFundingPubKey)
@@ -669,7 +671,6 @@ case class Commitment(fundingTxIndex: Long,
669671 val fundingKey = localFundingKey(channelKeys)
670672 val spec = CommitmentSpec .reduce(localCommit.spec, changes.localChanges.acked, changes.remoteChanges.proposed)
671673 LocalCommit .fromCommitSig(params, localCommitParams, commitKeys, fundingTxId, fundingKey, remoteFundingPubKey, commitInput(fundingKey), commit, localCommitIndex, spec, commitmentFormat).map { localCommit1 =>
672- log.info(s " built local commit number= $localCommitIndex toLocalMsat= ${spec.toLocal.toLong} toRemoteMsat= ${spec.toRemote.toLong} htlc_in={} htlc_out={} feeratePerKw= ${spec.commitTxFeerate} txid= ${localCommit1.txId} fundingTxId= $fundingTxId" , spec.htlcs.collect(DirectedHtlc .incoming).map(_.id).mkString(" ," ), spec.htlcs.collect(DirectedHtlc .outgoing).map(_.id).mkString(" ," ))
673674 copy(localCommit = localCommit1)
674675 }
675676 }
0 commit comments