]> git.bitcoin.ninja Git - rust-lightning/commit
Make `ChainMonitor::get_claimable_balances` take a slice of refs
authorMatt Corallo <git@bluematt.me>
Wed, 22 Sep 2021 03:57:53 +0000 (03:57 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 22 Sep 2021 04:42:31 +0000 (04:42 +0000)
commitd718822874160cf4bc67455b1821cfee44ec9f3d
tree174bfeda4b3df68fcf25701117a9880c845f7e96
parentaad1803517b03b60c6073ade6adcf9904efb4cf1
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.
lightning/src/chain/chainmonitor.rs