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
@ -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…
Reference in New Issue
Block a user