]> git.bitcoin.ninja Git - rust-lightning/commit
Remove unreachable `Err` cases on `derive_*_revocation_key`
authorMatt Corallo <git@bluematt.me>
Wed, 30 Nov 2022 22:34:11 +0000 (22:34 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 30 Nov 2022 22:34:11 +0000 (22:34 +0000)
commit5671d2930d996e864614703696ed2cba5e47e4f0
tree6ccf6dd75137bb8ae92ecc9b328700b8d5594eef
parent27461902ab3acd1b665ec9a91fd1768dbfee1c36
Remove unreachable `Err` cases on `derive_*_revocation_key`

The `derive_{public,private}_revocation_key` methods hash the two
input keys and then multiply the two input keys by hashed values
before adding them together. Because addition can fail if the tweak
is the inverse of the secret key this method currently returns a
`Result`.

However, it is not cryptographically possible to reach the error
case - in order to create an issue, the point-multiplied-by-hash
values must be the inverse of each other, however each point
commits the SHA-256 hash of both keys together. Thus, because
changing either key changes the hashes (and the ultimate points
added together) in an unpredictable way, there should be no way to
construct such points.
lightning/src/chain/channelmonitor.rs
lightning/src/chain/keysinterface.rs
lightning/src/ln/chan_utils.rs
lightning/src/ln/channel.rs