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 committed 2018-03-27 15:37:15 -07:00
1 parent b49d29c2b0
commit 6103ccb081
1 file changed
+7
+7
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
}