Fix a leak in `FutureState` when a `Notifier` is dropped un-woken
authorMatt Corallo <git@bluematt.me>
Wed, 26 Apr 2023 05:01:13 +0000 (05:01 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 26 Apr 2023 17:38:04 +0000 (17:38 +0000)
commit357781504fc347470de096d87785911dde2f75ff
tree4f8f10911de678b271072d881df50f9e80a81341
parenteffcc8ad862a63f8a39e9e0aee4e29b418c469ec
Fix a leak in `FutureState` when a `Notifier` is dropped un-woken

If a `Notifier` has an internal `FutureState` which gathers some
sleeper callbacks, but is never actaully woken, those callbacks
will leak due to a circular `Arc` reference when the `Notifier` is
`drop`'d.

Because `Notifier`s are rarely `drop`'d in production this isn't a
huge deal, but shows up materially in bindings tests as they spawn
many nodes over the course of a short test.

Fixes #2232
lightning/src/util/wakers.rs