Use signal for handling ChannelPending in test_background_event_handling
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Thu, 6 Apr 2023 21:59:04 +0000 (14:59 -0700)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Thu, 6 Apr 2023 22:10:12 +0000 (15:10 -0700)
commit503729836121306dbd81b0fc289accfebd1de48b
tree6d64271b311cb9b05339d26cd38408ba332c9275
parent5c6a39bd5be6bd5933f935d8dd1dbe8a54e36493
Use signal for handling ChannelPending in test_background_event_handling

This fixes two potential panics within the test if the
`BackgroundProcessor` for `nodes[0]` consumed the `ChannelPending` event
prior to us consuming it manually in `end_open_channel`. The first panic
would happen within the event handler, since `ChannelPending` was not
being handled. The second panic would happen upon expecting the
`ChannelPending` event after handling `nodes[1]`'s `funding_signed` if
the `BackgroundProcessor` handled the event first. To ensure we still
reliably receive a `ChannelPending` event once possible, we let the
`BackgroundProcessor` consume the event and notify it.
lightning-background-processor/src/lib.rs