]> git.bitcoin.ninja Git - rust-lightning/commit
Add an async resolution option to `ChainAccess::get_utxo`
authorMatt Corallo <git@bluematt.me>
Wed, 8 Feb 2023 22:06:11 +0000 (22:06 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 8 Feb 2023 23:54:30 +0000 (23:54 +0000)
commit2cca65058e4ce3e0120a3fe78a14ed82d1c3a43b
treecc5e2a0466c240ca64269c4f7ae4e06004089e40
parent1e8553fc675698bd3142459ad6421d5bd7aa72c7
Add an async resolution option to `ChainAccess::get_utxo`

For those operating in an async environment, requiring
`ChainAccess::get_utxo` return information about the requested UTXO
synchronously is incredibly painful. Requesting information about a
random UTXO is likely to go over the network, and likely to be a
rather slow request.

Thus, here, we change the return type of `get_utxo` to have both a
synchronous and asynchronous form. The asynchronous form requires
the user construct a `AccessFuture` which they `clone` and pass
back to us. Internally, an `AccessFuture` has an `Arc` to the
`channel_announcement` message which we need to process. When the
user completes their lookup, they call `resolve` on their
`AccessFuture` which we pull the `channel_announcement` from and
then apply to the network graph.
fuzz/src/router.rs
lightning/src/routing/gossip.rs
lightning/src/routing/utxo.rs
lightning/src/util/test_utils.rs