Merge bitcoindevkit/bdk#1070: Rename methods of esplora ext
20900218ceba728c8051a3c017a6341d74cbaee3 refactor: rename methods in EsploraExt and EsploraExtAsync (Vladimir Fomene) Pull request description: ### Description This PR fixes #1058. Built on top of #1040 ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### New Features: * [ ] I've added tests for the new feature * [ ] I've added docs for the new feature ACKs for top commit: realeinherjar: ACK 2090021 danielabrozzoni: ACK 20900218ceba728c8051a3c017a6341d74cbaee3 - code looks good, `example_esplora` and `wallet_esplora_blocking` work just fine. Tree-SHA512: 5b5285aaa67a0c4e8174e480cceec7d934ec04a74d81740e1c82f6b8673c3e3d9c676dc43257a170320089efe2d3cb0d33123b4a395fc3e7fec63f85bdf70c79
This commit is contained in:
commit
59fc1b341b
@ -48,7 +48,7 @@ pub trait EsploraAsyncExt {
|
||||
/// transactions. `parallel_requests` specifies the max number of HTTP requests to make in
|
||||
/// parallel.
|
||||
#[allow(clippy::result_large_err)]
|
||||
async fn update_tx_graph<K: Ord + Clone + Send>(
|
||||
async fn scan_txs_with_keychains<K: Ord + Clone + Send>(
|
||||
&self,
|
||||
keychain_spks: BTreeMap<
|
||||
K,
|
||||
@ -60,18 +60,18 @@ pub trait EsploraAsyncExt {
|
||||
parallel_requests: usize,
|
||||
) -> Result<(TxGraph<ConfirmationTimeAnchor>, BTreeMap<K, u32>), Error>;
|
||||
|
||||
/// Convenience method to call [`update_tx_graph`] without requiring a keychain.
|
||||
/// Convenience method to call [`scan_txs_with_keychains`] without requiring a keychain.
|
||||
///
|
||||
/// [`update_tx_graph`]: EsploraAsyncExt::update_tx_graph
|
||||
/// [`scan_txs_with_keychains`]: EsploraAsyncExt::scan_txs_with_keychains
|
||||
#[allow(clippy::result_large_err)]
|
||||
async fn update_tx_graph_without_keychain(
|
||||
async fn scan_txs(
|
||||
&self,
|
||||
misc_spks: impl IntoIterator<IntoIter = impl Iterator<Item = ScriptBuf> + Send> + Send,
|
||||
txids: impl IntoIterator<IntoIter = impl Iterator<Item = Txid> + Send> + Send,
|
||||
outpoints: impl IntoIterator<IntoIter = impl Iterator<Item = OutPoint> + Send> + Send,
|
||||
parallel_requests: usize,
|
||||
) -> Result<TxGraph<ConfirmationTimeAnchor>, Error> {
|
||||
self.update_tx_graph(
|
||||
self.scan_txs_with_keychains(
|
||||
[(
|
||||
(),
|
||||
misc_spks
|
||||
@ -201,7 +201,7 @@ impl EsploraAsyncExt for esplora_client::AsyncClient {
|
||||
})
|
||||
}
|
||||
|
||||
async fn update_tx_graph<K: Ord + Clone + Send>(
|
||||
async fn scan_txs_with_keychains<K: Ord + Clone + Send>(
|
||||
&self,
|
||||
keychain_spks: BTreeMap<
|
||||
K,
|
||||
|
@ -46,7 +46,7 @@ pub trait EsploraExt {
|
||||
/// transactions. `parallel_requests` specifies the max number of HTTP requests to make in
|
||||
/// parallel.
|
||||
#[allow(clippy::result_large_err)]
|
||||
fn update_tx_graph<K: Ord + Clone>(
|
||||
fn scan_txs_with_keychains<K: Ord + Clone>(
|
||||
&self,
|
||||
keychain_spks: BTreeMap<K, impl IntoIterator<Item = (u32, ScriptBuf)>>,
|
||||
txids: impl IntoIterator<Item = Txid>,
|
||||
@ -55,18 +55,18 @@ pub trait EsploraExt {
|
||||
parallel_requests: usize,
|
||||
) -> Result<(TxGraph<ConfirmationTimeAnchor>, BTreeMap<K, u32>), Error>;
|
||||
|
||||
/// Convenience method to call [`update_tx_graph`] without requiring a keychain.
|
||||
/// Convenience method to call [`scan_txs_with_keychains`] without requiring a keychain.
|
||||
///
|
||||
/// [`update_tx_graph`]: EsploraExt::update_tx_graph
|
||||
/// [`scan_txs_with_keychains`]: EsploraExt::scan_txs_with_keychains
|
||||
#[allow(clippy::result_large_err)]
|
||||
fn update_tx_graph_without_keychain(
|
||||
fn scan_txs(
|
||||
&self,
|
||||
misc_spks: impl IntoIterator<Item = ScriptBuf>,
|
||||
txids: impl IntoIterator<Item = Txid>,
|
||||
outpoints: impl IntoIterator<Item = OutPoint>,
|
||||
parallel_requests: usize,
|
||||
) -> Result<TxGraph<ConfirmationTimeAnchor>, Error> {
|
||||
self.update_tx_graph(
|
||||
self.scan_txs_with_keychains(
|
||||
[(
|
||||
(),
|
||||
misc_spks
|
||||
@ -192,7 +192,7 @@ impl EsploraExt for esplora_client::BlockingClient {
|
||||
})
|
||||
}
|
||||
|
||||
fn update_tx_graph<K: Ord + Clone>(
|
||||
fn scan_txs_with_keychains<K: Ord + Clone>(
|
||||
&self,
|
||||
keychain_spks: BTreeMap<K, impl IntoIterator<Item = (u32, ScriptBuf)>>,
|
||||
txids: impl IntoIterator<Item = Txid>,
|
||||
|
@ -154,7 +154,7 @@ fn main() -> anyhow::Result<()> {
|
||||
// represents the last active spk derivation indices of keychains
|
||||
// (`keychain_indices_update`).
|
||||
let (graph_update, last_active_indices) = client
|
||||
.update_tx_graph(
|
||||
.scan_txs_with_keychains(
|
||||
keychain_spks,
|
||||
core::iter::empty(),
|
||||
core::iter::empty(),
|
||||
@ -276,12 +276,8 @@ fn main() -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
let graph_update = client.update_tx_graph_without_keychain(
|
||||
spks,
|
||||
txids,
|
||||
outpoints,
|
||||
scan_options.parallel_requests,
|
||||
)?;
|
||||
let graph_update =
|
||||
client.scan_txs(spks, txids, outpoints, scan_options.parallel_requests)?;
|
||||
|
||||
graph.lock().unwrap().apply_update(graph_update)
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
})
|
||||
.collect();
|
||||
let (update_graph, last_active_indices) = client
|
||||
.update_tx_graph(keychain_spks, None, None, STOP_GAP, PARALLEL_REQUESTS)
|
||||
.scan_txs_with_keychains(keychain_spks, None, None, STOP_GAP, PARALLEL_REQUESTS)
|
||||
.await?;
|
||||
let missing_heights = wallet.tx_graph().missing_heights(wallet.local_chain());
|
||||
let chain_update = client.update_local_chain(prev_tip, missing_heights).await?;
|
||||
|
@ -55,7 +55,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.collect();
|
||||
|
||||
let (update_graph, last_active_indices) =
|
||||
client.update_tx_graph(keychain_spks, None, None, STOP_GAP, PARALLEL_REQUESTS)?;
|
||||
client.scan_txs_with_keychains(keychain_spks, None, None, STOP_GAP, PARALLEL_REQUESTS)?;
|
||||
let missing_heights = wallet.tx_graph().missing_heights(wallet.local_chain());
|
||||
let chain_update = client.update_local_chain(prev_tip, missing_heights)?;
|
||||
let update = WalletUpdate {
|
||||
|
Loading…
x
Reference in New Issue
Block a user