]> git.bitcoin.ninja Git - rust-lightning/commit
Make `ChainMonitor::monitors` private and expose monitor via getter
authorMatt Corallo <git@bluematt.me>
Fri, 8 Oct 2021 19:07:00 +0000 (19:07 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 14 Oct 2021 00:17:31 +0000 (00:17 +0000)
commit79541b11e8b6e62de0fc613f416e30bf1de5f3d9
tree23e7ccc148c30652958514e04a30560fa7307a93
parent6a7c48b60d855f992c395e4b1ae967a41890e074
Make `ChainMonitor::monitors` private and expose monitor via getter

Exposing a `RwLock<HashMap<>>` directly was always a bit strange,
and in upcoming changes we'd like to change the internal
datastructure in `ChainMonitor`.

Further, the use of `RwLock` and `HashMap` meant we weren't able
to expose the ChannelMonitors themselves to users in bindings,
leaving a bindings/rust API gap.

Thus, we take this opportunity go expose ChannelMonitors directly
via a wrapper, hiding the internals of `ChainMonitor` behind
getters. We also update tests to use the new API.
lightning/src/chain/chainmonitor.rs
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/monitor_tests.rs
lightning/src/ln/reorg_tests.rs
lightning/src/util/test_utils.rs