Skip to content

Commit

Permalink
lnwallet: ensure we only accept/produce sane commitments
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Roasbeef committed Mar 27, 2018
1 parent b49d29c commit 6103ccb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lnwallet/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 6103ccb

Please sign in to comment.