Use an opaque type to describe monitor updates in Persist
authorMatt Corallo <git@bluematt.me>
Thu, 7 Oct 2021 23:59:47 +0000 (23:59 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 19 Oct 2021 23:49:04 +0000 (23:49 +0000)
commit89ad05954891276dfb8524be904af78a8ec7ee82
tree98533241b40185c8867037312b5d984bd817ae06
parent4500270488e6ed918c5f6e07310eb4a384eb6e21
Use an opaque type to describe monitor updates in Persist

In the next commit, we'll be originating monitor updates both from
the ChainMonitor and from the ChannelManager, making simple
sequential update IDs impossible.

Further, the existing async monitor update API was somewhat hard to
work with - instead of being able to generate monitor_updated
callbacks whenever a persistence process finishes, you had to
ensure you only did so at least once all previous updates had also
been persisted.

Here we eat the complexity for the user by moving to an opaque
type for monitor updates, tracking which updates are in-flight for
the user and only generating monitor-persisted events once all
pending updates have been committed.
fuzz/src/chanmon_consistency.rs
fuzz/src/utils/test_persister.rs
lightning-persister/src/lib.rs
lightning/src/chain/chainmonitor.rs
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/util/test_utils.rs