Pull secp256k1 contexts from per-peer to per-PeerManager 2022-06-less-secp-ctx
authorMatt Corallo <git@bluematt.me>
Mon, 9 May 2022 23:03:50 +0000 (23:03 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 11 May 2022 20:02:29 +0000 (20:02 +0000)
commite6aaf7c72dac650d4351a0d3e4fe4c8e9ab37911
tree6a835a889b1597ea2db0561ff29a57a3350b22a4
parentb5a63070f52dbd2a9cadaf638de3f0b3d702bee7
Pull secp256k1 contexts from per-peer to per-PeerManager

Instead of including a `Secp256k1` context per
`PeerChannelEncryptor`, which is relatively expensive memory-wise
and nontrivial CPU-wise to construct, we should keep one for all
peers and simply reuse it.

This is relatively trivial so we do so in this commit.

Since its trivial to do so, we also take this opportunity to
randomize the new PeerManager context.
fuzz/src/peer_crypt.rs
lightning/src/ln/peer_channel_encryptor.rs
lightning/src/ln/peer_handler.rs