Add an `UnrecoverableError` variant to `ChannelMonitorUpdateStatus` 2023-08-no-perm-fail
authorMatt Corallo <git@bluematt.me>
Thu, 14 Sep 2023 20:02:46 +0000 (20:02 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 21 Sep 2023 19:12:31 +0000 (19:12 +0000)
commitf254c56585688a187a58dc284477cb1cd39b00a9
tree86440561c66af45986b0cbac016333ba48aca3f9
parentaa9c601774b11d1ef2958961f7479599625e798b
Add an `UnrecoverableError` variant to `ChannelMonitorUpdateStatus`

While there is no great way to handle a true failure to persist a
`ChannelMonitorUpdate`, it is confusing for users for there to be
no error variant at all on an I/O operation.

Thus, here we re-add the error variant removed over the past
handful of commits, but rather than handle it in a truly unsafe
way, we simply panic, optimizing for maximum mutex poisoning to
ensure any future operations fail and return immediately.

In the future, we may consider changing the handling of this to
instead set some "disconnect all peers and fail all operations"
bool to give the user a better chance to shutdown in a semi-orderly
fashion, but there's only so much that can be done in lightning if
we truly cannot persist new updates.
lightning-persister/src/fs_store.rs
lightning/src/chain/chainmonitor.rs
lightning/src/chain/mod.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/util/persist.rs