lnwallet: ensure we only accept/produce sane commitments

In this commit, we add an additional check within CreateCommitTx to
ensure that we will never create or accept a commitment transaction that
wasn't valid by consensus. To enforce this check, we use the
blockchain.CheckTransactionSanity method.
This commit is contained in:
Olaoluwa Osuntokun 2018-03-27 15:37:03 -07:00
parent b49d29c2b0
commit 6103ccb081
No known key found for this signature in database
GPG key ID: 964EA263DD637C21

View file

@ -5663,6 +5663,13 @@ 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
}