Unset the needs-notify bit in a Notifier when a Future is fetched
authorMatt Corallo <git@bluematt.me>
Mon, 14 Nov 2022 23:49:27 +0000 (23:49 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 16 Nov 2022 00:21:43 +0000 (00:21 +0000)
commit7527e4b7df674fc2f5442514bb7b1d2294e59ce8
tree79a216d6eeea89c0c262bee769d762f804961da7
parentbcf8687301a2f7522eec203bbc30e4286939221b
Unset the needs-notify bit in a Notifier when a Future is fetched

If a `Notifier` gets `notify()`ed and the a `Future` is fetched,
even though the `Future` is marked completed from the start and
the user may pass callbacks which are called, we'll never wipe the
needs-notify bit in the `Notifier`.

The solution is to keep track of the `FutureState` in the returned
`Future` even though its `complete` from the start, adding a new
flag in the `FutureState` which indicates callbacks have been made
and checking that flag when waiting or returning a second `Future`.
lightning/src/util/wakers.rs