diff --git a/lnwallet/channel.go b/lnwallet/channel.go index c98a53568..9e17a5977 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -2338,6 +2338,12 @@ func (lc *LightningChannel) createCommitmentTx(c *commitment, // instead we'll just send signatures. txsort.InPlaceSort(commitTx) + // Next, we'll ensure that we don't accidentally create a commitment + // transaction which would be invalid by consensus. + uTx := btcutil.NewTx(commitTx) + if err := blockchain.CheckTransactionSanity(uTx); err != nil { + return err + } c.txn = commitTx c.fee = commitFee c.ourBalance = ourBalance @@ -5795,13 +5801,6 @@ func CreateCommitTx(fundingOutput wire.TxIn, }) } - // Finally, we'll ensure that we don't accidentally create a commitment - // transaction which would be invalid by consensus. - uTx := btcutil.NewTx(commitTx) - if err := blockchain.CheckTransactionSanity(uTx); err != nil { - return nil, err - } - return commitTx, nil }