chore(chain): Standardise KeychainTxOutIndex return types

The previous commit b9c5b9d08b040faf6c6b2d9b3745918031555b72 added
IndexSpk. This goes further and adds `Indexed` and `KeychainIndexed`
type alises (IndexSpk is Indexed<ScriptBuf>) and attempts to standardize
the structure of return types more generally.
This commit is contained in:
LLFourn
2024-06-07 12:29:58 +10:00
committed by 志宇
parent bce070b1d6
commit 101a09a97f
12 changed files with 103 additions and 90 deletions

View File

@@ -8,7 +8,7 @@ use bdk_chain::{
local_chain::CheckPoint,
BlockId, ConfirmationTimeHeightAnchor, TxGraph,
};
use bdk_chain::{Anchor, IndexSpk};
use bdk_chain::{Anchor, Indexed};
use esplora_client::{Amount, TxStatus};
use futures::{stream::FuturesOrdered, TryStreamExt};
@@ -236,7 +236,7 @@ async fn full_scan_for_index_and_graph<K: Ord + Clone + Send>(
client: &esplora_client::AsyncClient,
keychain_spks: BTreeMap<
K,
impl IntoIterator<IntoIter = impl Iterator<Item = IndexSpk> + Send> + Send,
impl IntoIterator<IntoIter = impl Iterator<Item = Indexed<ScriptBuf>> + Send> + Send,
>,
stop_gap: usize,
parallel_requests: usize,

View File

@@ -9,7 +9,7 @@ use bdk_chain::{
local_chain::CheckPoint,
BlockId, ConfirmationTimeHeightAnchor, TxGraph,
};
use bdk_chain::{Anchor, IndexSpk};
use bdk_chain::{Anchor, Indexed};
use esplora_client::TxStatus;
use crate::anchor_from_status;
@@ -217,7 +217,7 @@ fn chain_update<A: Anchor>(
/// [`KeychainTxOutIndex`](bdk_chain::keychain::KeychainTxOutIndex).
fn full_scan_for_index_and_graph_blocking<K: Ord + Clone>(
client: &esplora_client::BlockingClient,
keychain_spks: BTreeMap<K, impl IntoIterator<Item = IndexSpk>>,
keychain_spks: BTreeMap<K, impl IntoIterator<Item = Indexed<ScriptBuf>>>,
stop_gap: usize,
parallel_requests: usize,
) -> Result<(TxGraph<ConfirmationTimeHeightAnchor>, BTreeMap<K, u32>), Error> {