mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
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:
parent
b49d29c2b0
commit
6103ccb081
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue