Skip to content

Commit

Permalink
Use shared input's txOut in shouldSignFirst (#2934)
Browse files Browse the repository at this point in the history
This is clearer that way and yields the same result: we only look at
`txOut` amounts when computing each node's contributions.
  • Loading branch information
t-bast authored Oct 24, 2024
1 parent 96d0c9a commit 4ca8ea0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ object InteractiveTxSigningSession {
case class UnsignedLocalCommit(index: Long, spec: CommitmentSpec, commitTx: CommitTx, htlcTxs: List[HtlcTx])

private def shouldSignFirst(isInitiator: Boolean, channelParams: ChannelParams, tx: SharedTransaction): Boolean = {
val sharedAmountIn = tx.sharedInput_opt.map(i => i.localAmount + i.remoteAmount + i.htlcAmount).getOrElse(0 msat).truncateToSatoshi
val sharedAmountIn = tx.sharedInput_opt.map(_.txOut.amount).getOrElse(0 sat)
val (localAmountIn, remoteAmountIn) = if (isInitiator) {
(sharedAmountIn + tx.localInputs.map(i => i.txOut.amount).sum, tx.remoteInputs.map(i => i.txOut.amount).sum)
} else {
Expand Down

0 comments on commit 4ca8ea0

Please sign in to comment.