Skip to content

Commit d718822

Browse files
committed
Make ChainMonitor::get_claimable_balances take a slice of refs
For the same reason as `get_route`, a slice of objects isn't practical to map to bindings - the objects in the bindings space are structs with a pointer and some additional metadata. Thus, to create a slice of them, we'd need to take ownership of the objects behind the pointer, place them into a slace, and then restore them to the pointer. This would be a lot of memory copying and marshalling, not to mention wouldn't be thread-safe, which the same function otherwise would be if we used a slice of references instead of a slice of objects.
1 parent aad1803 commit d718822

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightning/src/chain/chainmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ where C::Target: chain::Filter,
150150
///
151151
/// See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
152152
/// inclusion in the return value.
153-
pub fn get_claimable_balances(&self, ignored_channels: &[ChannelDetails]) -> Vec<Balance> {
153+
pub fn get_claimable_balances(&self, ignored_channels: &[&ChannelDetails]) -> Vec<Balance> {
154154
let mut ret = Vec::new();
155155
let monitors = self.monitors.read().unwrap();
156156
for (_, monitor) in monitors.iter().filter(|(funding_outpoint, _)| {

0 commit comments

Comments
 (0)