]> git.bitcoin.ninja Git - rust-lightning/commit
Remove unreachable `Err` cases on `derive_{public,private}_key`
authorMatt Corallo <git@bluematt.me>
Wed, 30 Nov 2022 22:21:24 +0000 (22:21 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 30 Nov 2022 22:21:24 +0000 (22:21 +0000)
commit27461902ab3acd1b665ec9a91fd1768dbfee1c36
tree2f110e8d1cd238cb6ade3fe9b2fee6dda379c2d2
parent440c3eec2f0e18bd93fc4a01fb95ac6dd79f941e
Remove unreachable `Err` cases on `derive_{public,private}_key`

The `derive_{public,private}_key` methods hash the two input keys
and then add them to the input public key. 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 SHA-256 hash of the
`base_point` (and other data) must be the inverse of the
`base_point`('s secret key). Because changing the `base_point`
changes the hash in an unpredictable way, there should be no way to
construct such a `base_point`.
lightning/src/chain/channelmonitor.rs
lightning/src/chain/keysinterface.rs
lightning/src/ln/chan_utils.rs
lightning/src/ln/channel.rs