chore: rename ConfirmationTimeAnchor
to ConfirmationTimeHeightAnchor
An `Anchor` implementation that records both height and time should have both attributes included in the name.
This commit is contained in:
parent
0a7b60f0f7
commit
0112c67b60
@ -25,7 +25,7 @@ use bdk_chain::{
|
|||||||
keychain::{self, KeychainTxOutIndex},
|
keychain::{self, KeychainTxOutIndex},
|
||||||
local_chain::{self, CannotConnectError, CheckPoint, CheckPointIter, LocalChain},
|
local_chain::{self, CannotConnectError, CheckPoint, CheckPointIter, LocalChain},
|
||||||
tx_graph::{CanonicalTx, TxGraph},
|
tx_graph::{CanonicalTx, TxGraph},
|
||||||
Append, BlockId, ChainPosition, ConfirmationTime, ConfirmationTimeAnchor, FullTxOut,
|
Append, BlockId, ChainPosition, ConfirmationTime, ConfirmationTimeHeightAnchor, FullTxOut,
|
||||||
IndexedTxGraph, Persist, PersistBackend,
|
IndexedTxGraph, Persist, PersistBackend,
|
||||||
};
|
};
|
||||||
use bitcoin::consensus::encode::serialize;
|
use bitcoin::consensus::encode::serialize;
|
||||||
@ -89,7 +89,7 @@ pub struct Wallet<D = ()> {
|
|||||||
signers: Arc<SignersContainer>,
|
signers: Arc<SignersContainer>,
|
||||||
change_signers: Arc<SignersContainer>,
|
change_signers: Arc<SignersContainer>,
|
||||||
chain: LocalChain,
|
chain: LocalChain,
|
||||||
indexed_graph: IndexedTxGraph<ConfirmationTimeAnchor, KeychainTxOutIndex<KeychainKind>>,
|
indexed_graph: IndexedTxGraph<ConfirmationTimeHeightAnchor, KeychainTxOutIndex<KeychainKind>>,
|
||||||
persist: Persist<D, ChangeSet>,
|
persist: Persist<D, ChangeSet>,
|
||||||
network: Network,
|
network: Network,
|
||||||
secp: SecpCtx,
|
secp: SecpCtx,
|
||||||
@ -105,7 +105,7 @@ pub struct Update {
|
|||||||
pub last_active_indices: BTreeMap<KeychainKind, u32>,
|
pub last_active_indices: BTreeMap<KeychainKind, u32>,
|
||||||
|
|
||||||
/// Update for the wallet's internal [`TxGraph`].
|
/// Update for the wallet's internal [`TxGraph`].
|
||||||
pub graph: TxGraph<ConfirmationTimeAnchor>,
|
pub graph: TxGraph<ConfirmationTimeHeightAnchor>,
|
||||||
|
|
||||||
/// Update for the wallet's internal [`LocalChain`].
|
/// Update for the wallet's internal [`LocalChain`].
|
||||||
///
|
///
|
||||||
@ -124,8 +124,10 @@ pub struct ChangeSet {
|
|||||||
/// Changes to [`IndexedTxGraph`].
|
/// Changes to [`IndexedTxGraph`].
|
||||||
///
|
///
|
||||||
/// [`IndexedTxGraph`]: bdk_chain::indexed_tx_graph::IndexedTxGraph
|
/// [`IndexedTxGraph`]: bdk_chain::indexed_tx_graph::IndexedTxGraph
|
||||||
pub indexed_tx_graph:
|
pub indexed_tx_graph: indexed_tx_graph::ChangeSet<
|
||||||
indexed_tx_graph::ChangeSet<ConfirmationTimeAnchor, keychain::ChangeSet<KeychainKind>>,
|
ConfirmationTimeHeightAnchor,
|
||||||
|
keychain::ChangeSet<KeychainKind>,
|
||||||
|
>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Append for ChangeSet {
|
impl Append for ChangeSet {
|
||||||
@ -148,12 +150,17 @@ impl From<local_chain::ChangeSet> for ChangeSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<indexed_tx_graph::ChangeSet<ConfirmationTimeAnchor, keychain::ChangeSet<KeychainKind>>>
|
impl
|
||||||
for ChangeSet
|
From<
|
||||||
|
indexed_tx_graph::ChangeSet<
|
||||||
|
ConfirmationTimeHeightAnchor,
|
||||||
|
keychain::ChangeSet<KeychainKind>,
|
||||||
|
>,
|
||||||
|
> for ChangeSet
|
||||||
{
|
{
|
||||||
fn from(
|
fn from(
|
||||||
indexed_tx_graph: indexed_tx_graph::ChangeSet<
|
indexed_tx_graph: indexed_tx_graph::ChangeSet<
|
||||||
ConfirmationTimeAnchor,
|
ConfirmationTimeHeightAnchor,
|
||||||
keychain::ChangeSet<KeychainKind>,
|
keychain::ChangeSet<KeychainKind>,
|
||||||
>,
|
>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
@ -279,8 +286,10 @@ impl<D> Wallet<D> {
|
|||||||
{
|
{
|
||||||
let secp = Secp256k1::new();
|
let secp = Secp256k1::new();
|
||||||
let mut chain = LocalChain::default();
|
let mut chain = LocalChain::default();
|
||||||
let mut indexed_graph =
|
let mut indexed_graph = IndexedTxGraph::<
|
||||||
IndexedTxGraph::<ConfirmationTimeAnchor, KeychainTxOutIndex<KeychainKind>>::default();
|
ConfirmationTimeHeightAnchor,
|
||||||
|
KeychainTxOutIndex<KeychainKind>,
|
||||||
|
>::default();
|
||||||
|
|
||||||
let (descriptor, keymap) = into_wallet_descriptor_checked(descriptor, &secp, network)
|
let (descriptor, keymap) = into_wallet_descriptor_checked(descriptor, &secp, network)
|
||||||
.map_err(NewError::Descriptor)?;
|
.map_err(NewError::Descriptor)?;
|
||||||
@ -654,7 +663,7 @@ impl<D> Wallet<D> {
|
|||||||
pub fn get_tx(
|
pub fn get_tx(
|
||||||
&self,
|
&self,
|
||||||
txid: Txid,
|
txid: Txid,
|
||||||
) -> Option<CanonicalTx<'_, Transaction, ConfirmationTimeAnchor>> {
|
) -> Option<CanonicalTx<'_, Transaction, ConfirmationTimeHeightAnchor>> {
|
||||||
let graph = self.indexed_graph.graph();
|
let graph = self.indexed_graph.graph();
|
||||||
|
|
||||||
Some(CanonicalTx {
|
Some(CanonicalTx {
|
||||||
@ -724,7 +733,7 @@ impl<D> Wallet<D> {
|
|||||||
tip_height: self.chain.tip().map(|b| b.height()),
|
tip_height: self.chain.tip().map(|b| b.height()),
|
||||||
tx_height: height,
|
tx_height: height,
|
||||||
})
|
})
|
||||||
.map(|(&anchor_height, &hash)| ConfirmationTimeAnchor {
|
.map(|(&anchor_height, &hash)| ConfirmationTimeHeightAnchor {
|
||||||
anchor_block: BlockId {
|
anchor_block: BlockId {
|
||||||
height: anchor_height,
|
height: anchor_height,
|
||||||
hash,
|
hash,
|
||||||
@ -756,7 +765,7 @@ impl<D> Wallet<D> {
|
|||||||
/// Iterate over the transactions in the wallet.
|
/// Iterate over the transactions in the wallet.
|
||||||
pub fn transactions(
|
pub fn transactions(
|
||||||
&self,
|
&self,
|
||||||
) -> impl Iterator<Item = CanonicalTx<'_, Transaction, ConfirmationTimeAnchor>> + '_ {
|
) -> impl Iterator<Item = CanonicalTx<'_, Transaction, ConfirmationTimeHeightAnchor>> + '_ {
|
||||||
self.indexed_graph.graph().list_chain_txs(
|
self.indexed_graph.graph().list_chain_txs(
|
||||||
&self.chain,
|
&self.chain,
|
||||||
self.chain.tip().map(|cp| cp.block_id()).unwrap_or_default(),
|
self.chain.tip().map(|cp| cp.block_id()).unwrap_or_default(),
|
||||||
@ -1973,7 +1982,7 @@ impl<D> Wallet<D> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get a reference to the inner [`TxGraph`].
|
/// Get a reference to the inner [`TxGraph`].
|
||||||
pub fn tx_graph(&self) -> &TxGraph<ConfirmationTimeAnchor> {
|
pub fn tx_graph(&self) -> &TxGraph<ConfirmationTimeHeightAnchor> {
|
||||||
self.indexed_graph.graph()
|
self.indexed_graph.graph()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1988,8 +1997,8 @@ impl<D> Wallet<D> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<D> AsRef<bdk_chain::tx_graph::TxGraph<ConfirmationTimeAnchor>> for Wallet<D> {
|
impl<D> AsRef<bdk_chain::tx_graph::TxGraph<ConfirmationTimeHeightAnchor>> for Wallet<D> {
|
||||||
fn as_ref(&self) -> &bdk_chain::tx_graph::TxGraph<ConfirmationTimeAnchor> {
|
fn as_ref(&self) -> &bdk_chain::tx_graph::TxGraph<ConfirmationTimeHeightAnchor> {
|
||||||
self.indexed_graph.graph()
|
self.indexed_graph.graph()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2028,7 +2037,7 @@ where
|
|||||||
fn new_local_utxo(
|
fn new_local_utxo(
|
||||||
keychain: KeychainKind,
|
keychain: KeychainKind,
|
||||||
derivation_index: u32,
|
derivation_index: u32,
|
||||||
full_txo: FullTxOut<ConfirmationTimeAnchor>,
|
full_txo: FullTxOut<ConfirmationTimeHeightAnchor>,
|
||||||
) -> LocalUtxo {
|
) -> LocalUtxo {
|
||||||
LocalUtxo {
|
LocalUtxo {
|
||||||
outpoint: full_txo.outpoint,
|
outpoint: full_txo.outpoint,
|
||||||
|
@ -74,8 +74,8 @@ impl ConfirmationTime {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ChainPosition<ConfirmationTimeAnchor>> for ConfirmationTime {
|
impl From<ChainPosition<ConfirmationTimeHeightAnchor>> for ConfirmationTime {
|
||||||
fn from(observed_as: ChainPosition<ConfirmationTimeAnchor>) -> Self {
|
fn from(observed_as: ChainPosition<ConfirmationTimeHeightAnchor>) -> Self {
|
||||||
match observed_as {
|
match observed_as {
|
||||||
ChainPosition::Confirmed(a) => Self::Confirmed {
|
ChainPosition::Confirmed(a) => Self::Confirmed {
|
||||||
height: a.confirmation_height,
|
height: a.confirmation_height,
|
||||||
@ -193,7 +193,7 @@ impl AnchorFromBlockPosition for ConfirmationHeightAnchor {
|
|||||||
derive(serde::Deserialize, serde::Serialize),
|
derive(serde::Deserialize, serde::Serialize),
|
||||||
serde(crate = "serde_crate")
|
serde(crate = "serde_crate")
|
||||||
)]
|
)]
|
||||||
pub struct ConfirmationTimeAnchor {
|
pub struct ConfirmationTimeHeightAnchor {
|
||||||
/// The anchor block.
|
/// The anchor block.
|
||||||
pub anchor_block: BlockId,
|
pub anchor_block: BlockId,
|
||||||
/// The confirmation height of the chain data being anchored.
|
/// The confirmation height of the chain data being anchored.
|
||||||
@ -202,7 +202,7 @@ pub struct ConfirmationTimeAnchor {
|
|||||||
pub confirmation_time: u64,
|
pub confirmation_time: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Anchor for ConfirmationTimeAnchor {
|
impl Anchor for ConfirmationTimeHeightAnchor {
|
||||||
fn anchor_block(&self) -> BlockId {
|
fn anchor_block(&self) -> BlockId {
|
||||||
self.anchor_block
|
self.anchor_block
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ impl Anchor for ConfirmationTimeAnchor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AnchorFromBlockPosition for ConfirmationTimeAnchor {
|
impl AnchorFromBlockPosition for ConfirmationTimeHeightAnchor {
|
||||||
fn from_block_position(block: &bitcoin::Block, block_id: BlockId, _tx_pos: usize) -> Self {
|
fn from_block_position(block: &bitcoin::Block, block_id: BlockId, _tx_pos: usize) -> Self {
|
||||||
Self {
|
Self {
|
||||||
anchor_block: block_id,
|
anchor_block: block_id,
|
||||||
|
@ -2,7 +2,7 @@ use bdk_chain::{
|
|||||||
bitcoin::{OutPoint, ScriptBuf, Transaction, Txid},
|
bitcoin::{OutPoint, ScriptBuf, Transaction, Txid},
|
||||||
local_chain::{self, CheckPoint},
|
local_chain::{self, CheckPoint},
|
||||||
tx_graph::{self, TxGraph},
|
tx_graph::{self, TxGraph},
|
||||||
Anchor, BlockId, ConfirmationHeightAnchor, ConfirmationTimeAnchor,
|
Anchor, BlockId, ConfirmationHeightAnchor, ConfirmationTimeHeightAnchor,
|
||||||
};
|
};
|
||||||
use electrum_client::{Client, ElectrumApi, Error, HeaderNotification};
|
use electrum_client::{Client, ElectrumApi, Error, HeaderNotification};
|
||||||
use std::{
|
use std::{
|
||||||
@ -57,7 +57,7 @@ impl RelevantTxids {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Finalizes [`RelevantTxids`] with `new_txs` and anchors of type
|
/// Finalizes [`RelevantTxids`] with `new_txs` and anchors of type
|
||||||
/// [`ConfirmationTimeAnchor`].
|
/// [`ConfirmationTimeHeightAnchor`].
|
||||||
///
|
///
|
||||||
/// **Note:** The confirmation time might not be precisely correct if there has been a reorg.
|
/// **Note:** The confirmation time might not be precisely correct if there has been a reorg.
|
||||||
/// Electrum's API intends that we use the merkle proof API, we should change `bdk_electrum` to
|
/// Electrum's API intends that we use the merkle proof API, we should change `bdk_electrum` to
|
||||||
@ -67,7 +67,7 @@ impl RelevantTxids {
|
|||||||
client: &Client,
|
client: &Client,
|
||||||
seen_at: Option<u64>,
|
seen_at: Option<u64>,
|
||||||
missing: Vec<Txid>,
|
missing: Vec<Txid>,
|
||||||
) -> Result<TxGraph<ConfirmationTimeAnchor>, Error> {
|
) -> Result<TxGraph<ConfirmationTimeHeightAnchor>, Error> {
|
||||||
let graph = self.into_tx_graph(client, seen_at, missing)?;
|
let graph = self.into_tx_graph(client, seen_at, missing)?;
|
||||||
|
|
||||||
let relevant_heights = {
|
let relevant_heights = {
|
||||||
@ -103,7 +103,7 @@ impl RelevantTxids {
|
|||||||
.map(|(height_anchor, txid)| {
|
.map(|(height_anchor, txid)| {
|
||||||
let confirmation_height = height_anchor.confirmation_height;
|
let confirmation_height = height_anchor.confirmation_height;
|
||||||
let confirmation_time = height_to_time[&confirmation_height];
|
let confirmation_time = height_to_time[&confirmation_height];
|
||||||
let time_anchor = ConfirmationTimeAnchor {
|
let time_anchor = ConfirmationTimeHeightAnchor {
|
||||||
anchor_block: height_anchor.anchor_block,
|
anchor_block: height_anchor.anchor_block,
|
||||||
confirmation_height,
|
confirmation_height,
|
||||||
confirmation_time,
|
confirmation_time,
|
||||||
|
@ -4,7 +4,7 @@ use bdk_chain::{
|
|||||||
bitcoin::{BlockHash, OutPoint, ScriptBuf, Txid},
|
bitcoin::{BlockHash, OutPoint, ScriptBuf, Txid},
|
||||||
collections::{BTreeMap, BTreeSet},
|
collections::{BTreeMap, BTreeSet},
|
||||||
local_chain::{self, CheckPoint},
|
local_chain::{self, CheckPoint},
|
||||||
BlockId, ConfirmationTimeAnchor, TxGraph,
|
BlockId, ConfirmationTimeHeightAnchor, TxGraph,
|
||||||
};
|
};
|
||||||
use esplora_client::{Error, TxStatus};
|
use esplora_client::{Error, TxStatus};
|
||||||
use futures::{stream::FuturesOrdered, TryStreamExt};
|
use futures::{stream::FuturesOrdered, TryStreamExt};
|
||||||
@ -40,7 +40,7 @@ pub trait EsploraAsyncExt {
|
|||||||
/// indices.
|
/// indices.
|
||||||
///
|
///
|
||||||
/// * `keychain_spks`: keychains that we want to scan transactions for
|
/// * `keychain_spks`: keychains that we want to scan transactions for
|
||||||
/// * `txids`: transactions for which we want updated [`ConfirmationTimeAnchor`]s
|
/// * `txids`: transactions for which we want updated [`ConfirmationTimeHeightAnchor`]s
|
||||||
/// * `outpoints`: transactions associated with these outpoints (residing, spending) that we
|
/// * `outpoints`: transactions associated with these outpoints (residing, spending) that we
|
||||||
/// want to include in the update
|
/// want to include in the update
|
||||||
///
|
///
|
||||||
@ -58,7 +58,7 @@ pub trait EsploraAsyncExt {
|
|||||||
outpoints: impl IntoIterator<IntoIter = impl Iterator<Item = OutPoint> + Send> + Send,
|
outpoints: impl IntoIterator<IntoIter = impl Iterator<Item = OutPoint> + Send> + Send,
|
||||||
stop_gap: usize,
|
stop_gap: usize,
|
||||||
parallel_requests: usize,
|
parallel_requests: usize,
|
||||||
) -> Result<(TxGraph<ConfirmationTimeAnchor>, BTreeMap<K, u32>), Error>;
|
) -> Result<(TxGraph<ConfirmationTimeHeightAnchor>, BTreeMap<K, u32>), Error>;
|
||||||
|
|
||||||
/// Convenience method to call [`scan_txs_with_keychains`] without requiring a keychain.
|
/// Convenience method to call [`scan_txs_with_keychains`] without requiring a keychain.
|
||||||
///
|
///
|
||||||
@ -70,7 +70,7 @@ pub trait EsploraAsyncExt {
|
|||||||
txids: impl IntoIterator<IntoIter = impl Iterator<Item = Txid> + Send> + Send,
|
txids: impl IntoIterator<IntoIter = impl Iterator<Item = Txid> + Send> + Send,
|
||||||
outpoints: impl IntoIterator<IntoIter = impl Iterator<Item = OutPoint> + Send> + Send,
|
outpoints: impl IntoIterator<IntoIter = impl Iterator<Item = OutPoint> + Send> + Send,
|
||||||
parallel_requests: usize,
|
parallel_requests: usize,
|
||||||
) -> Result<TxGraph<ConfirmationTimeAnchor>, Error> {
|
) -> Result<TxGraph<ConfirmationTimeHeightAnchor>, Error> {
|
||||||
self.scan_txs_with_keychains(
|
self.scan_txs_with_keychains(
|
||||||
[(
|
[(
|
||||||
(),
|
(),
|
||||||
@ -211,10 +211,10 @@ impl EsploraAsyncExt for esplora_client::AsyncClient {
|
|||||||
outpoints: impl IntoIterator<IntoIter = impl Iterator<Item = OutPoint> + Send> + Send,
|
outpoints: impl IntoIterator<IntoIter = impl Iterator<Item = OutPoint> + Send> + Send,
|
||||||
stop_gap: usize,
|
stop_gap: usize,
|
||||||
parallel_requests: usize,
|
parallel_requests: usize,
|
||||||
) -> Result<(TxGraph<ConfirmationTimeAnchor>, BTreeMap<K, u32>), Error> {
|
) -> Result<(TxGraph<ConfirmationTimeHeightAnchor>, BTreeMap<K, u32>), Error> {
|
||||||
type TxsOfSpkIndex = (u32, Vec<esplora_client::Tx>);
|
type TxsOfSpkIndex = (u32, Vec<esplora_client::Tx>);
|
||||||
let parallel_requests = Ord::max(parallel_requests, 1);
|
let parallel_requests = Ord::max(parallel_requests, 1);
|
||||||
let mut graph = TxGraph::<ConfirmationTimeAnchor>::default();
|
let mut graph = TxGraph::<ConfirmationTimeHeightAnchor>::default();
|
||||||
let mut last_active_indexes = BTreeMap::<K, u32>::new();
|
let mut last_active_indexes = BTreeMap::<K, u32>::new();
|
||||||
|
|
||||||
for (keychain, spks) in keychain_spks {
|
for (keychain, spks) in keychain_spks {
|
||||||
|
@ -5,7 +5,7 @@ use bdk_chain::collections::{BTreeMap, BTreeSet};
|
|||||||
use bdk_chain::{
|
use bdk_chain::{
|
||||||
bitcoin::{BlockHash, OutPoint, ScriptBuf, Txid},
|
bitcoin::{BlockHash, OutPoint, ScriptBuf, Txid},
|
||||||
local_chain::{self, CheckPoint},
|
local_chain::{self, CheckPoint},
|
||||||
BlockId, ConfirmationTimeAnchor, TxGraph,
|
BlockId, ConfirmationTimeHeightAnchor, TxGraph,
|
||||||
};
|
};
|
||||||
use esplora_client::{Error, TxStatus};
|
use esplora_client::{Error, TxStatus};
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ pub trait EsploraExt {
|
|||||||
/// indices.
|
/// indices.
|
||||||
///
|
///
|
||||||
/// * `keychain_spks`: keychains that we want to scan transactions for
|
/// * `keychain_spks`: keychains that we want to scan transactions for
|
||||||
/// * `txids`: transactions for which we want updated [`ConfirmationTimeAnchor`]s
|
/// * `txids`: transactions for which we want updated [`ConfirmationTimeHeightAnchor`]s
|
||||||
/// * `outpoints`: transactions associated with these outpoints (residing, spending) that we
|
/// * `outpoints`: transactions associated with these outpoints (residing, spending) that we
|
||||||
/// want to include in the update
|
/// want to include in the update
|
||||||
///
|
///
|
||||||
@ -53,7 +53,7 @@ pub trait EsploraExt {
|
|||||||
outpoints: impl IntoIterator<Item = OutPoint>,
|
outpoints: impl IntoIterator<Item = OutPoint>,
|
||||||
stop_gap: usize,
|
stop_gap: usize,
|
||||||
parallel_requests: usize,
|
parallel_requests: usize,
|
||||||
) -> Result<(TxGraph<ConfirmationTimeAnchor>, BTreeMap<K, u32>), Error>;
|
) -> Result<(TxGraph<ConfirmationTimeHeightAnchor>, BTreeMap<K, u32>), Error>;
|
||||||
|
|
||||||
/// Convenience method to call [`scan_txs_with_keychains`] without requiring a keychain.
|
/// Convenience method to call [`scan_txs_with_keychains`] without requiring a keychain.
|
||||||
///
|
///
|
||||||
@ -65,7 +65,7 @@ pub trait EsploraExt {
|
|||||||
txids: impl IntoIterator<Item = Txid>,
|
txids: impl IntoIterator<Item = Txid>,
|
||||||
outpoints: impl IntoIterator<Item = OutPoint>,
|
outpoints: impl IntoIterator<Item = OutPoint>,
|
||||||
parallel_requests: usize,
|
parallel_requests: usize,
|
||||||
) -> Result<TxGraph<ConfirmationTimeAnchor>, Error> {
|
) -> Result<TxGraph<ConfirmationTimeHeightAnchor>, Error> {
|
||||||
self.scan_txs_with_keychains(
|
self.scan_txs_with_keychains(
|
||||||
[(
|
[(
|
||||||
(),
|
(),
|
||||||
@ -199,10 +199,10 @@ impl EsploraExt for esplora_client::BlockingClient {
|
|||||||
outpoints: impl IntoIterator<Item = OutPoint>,
|
outpoints: impl IntoIterator<Item = OutPoint>,
|
||||||
stop_gap: usize,
|
stop_gap: usize,
|
||||||
parallel_requests: usize,
|
parallel_requests: usize,
|
||||||
) -> Result<(TxGraph<ConfirmationTimeAnchor>, BTreeMap<K, u32>), Error> {
|
) -> Result<(TxGraph<ConfirmationTimeHeightAnchor>, BTreeMap<K, u32>), Error> {
|
||||||
type TxsOfSpkIndex = (u32, Vec<esplora_client::Tx>);
|
type TxsOfSpkIndex = (u32, Vec<esplora_client::Tx>);
|
||||||
let parallel_requests = Ord::max(parallel_requests, 1);
|
let parallel_requests = Ord::max(parallel_requests, 1);
|
||||||
let mut graph = TxGraph::<ConfirmationTimeAnchor>::default();
|
let mut graph = TxGraph::<ConfirmationTimeHeightAnchor>::default();
|
||||||
let mut last_active_indexes = BTreeMap::<K, u32>::new();
|
let mut last_active_indexes = BTreeMap::<K, u32>::new();
|
||||||
|
|
||||||
for (keychain, spks) in keychain_spks {
|
for (keychain, spks) in keychain_spks {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
use bdk_chain::{BlockId, ConfirmationTimeAnchor};
|
use bdk_chain::{BlockId, ConfirmationTimeHeightAnchor};
|
||||||
use esplora_client::TxStatus;
|
use esplora_client::TxStatus;
|
||||||
|
|
||||||
pub use esplora_client;
|
pub use esplora_client;
|
||||||
@ -16,7 +16,7 @@ pub use async_ext::*;
|
|||||||
|
|
||||||
const ASSUME_FINAL_DEPTH: u32 = 15;
|
const ASSUME_FINAL_DEPTH: u32 = 15;
|
||||||
|
|
||||||
fn anchor_from_status(status: &TxStatus) -> Option<ConfirmationTimeAnchor> {
|
fn anchor_from_status(status: &TxStatus) -> Option<ConfirmationTimeHeightAnchor> {
|
||||||
if let TxStatus {
|
if let TxStatus {
|
||||||
block_height: Some(height),
|
block_height: Some(height),
|
||||||
block_hash: Some(hash),
|
block_hash: Some(hash),
|
||||||
@ -24,7 +24,7 @@ fn anchor_from_status(status: &TxStatus) -> Option<ConfirmationTimeAnchor> {
|
|||||||
..
|
..
|
||||||
} = status.clone()
|
} = status.clone()
|
||||||
{
|
{
|
||||||
Some(ConfirmationTimeAnchor {
|
Some(ConfirmationTimeHeightAnchor {
|
||||||
anchor_block: BlockId { height, hash },
|
anchor_block: BlockId { height, hash },
|
||||||
confirmation_height: height,
|
confirmation_height: height,
|
||||||
confirmation_time: time,
|
confirmation_time: time,
|
||||||
|
@ -15,7 +15,7 @@ use bdk_chain::{
|
|||||||
bitcoin::{Block, Transaction},
|
bitcoin::{Block, Transaction},
|
||||||
indexed_tx_graph, keychain,
|
indexed_tx_graph, keychain,
|
||||||
local_chain::{self, CheckPoint, LocalChain},
|
local_chain::{self, CheckPoint, LocalChain},
|
||||||
ConfirmationTimeAnchor, IndexedTxGraph,
|
ConfirmationTimeHeightAnchor, IndexedTxGraph,
|
||||||
};
|
};
|
||||||
use example_cli::{
|
use example_cli::{
|
||||||
anyhow,
|
anyhow,
|
||||||
@ -37,7 +37,7 @@ const DB_COMMIT_DELAY: Duration = Duration::from_secs(60);
|
|||||||
|
|
||||||
type ChangeSet = (
|
type ChangeSet = (
|
||||||
local_chain::ChangeSet,
|
local_chain::ChangeSet,
|
||||||
indexed_tx_graph::ChangeSet<ConfirmationTimeAnchor, keychain::ChangeSet<Keychain>>,
|
indexed_tx_graph::ChangeSet<ConfirmationTimeHeightAnchor, keychain::ChangeSet<Keychain>>,
|
||||||
);
|
);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -9,7 +9,7 @@ use bdk_chain::{
|
|||||||
indexed_tx_graph::{self, IndexedTxGraph},
|
indexed_tx_graph::{self, IndexedTxGraph},
|
||||||
keychain,
|
keychain,
|
||||||
local_chain::{self, CheckPoint, LocalChain},
|
local_chain::{self, CheckPoint, LocalChain},
|
||||||
Append, ConfirmationTimeAnchor,
|
Append, ConfirmationTimeHeightAnchor,
|
||||||
};
|
};
|
||||||
|
|
||||||
use bdk_esplora::{esplora_client, EsploraExt};
|
use bdk_esplora::{esplora_client, EsploraExt};
|
||||||
@ -25,7 +25,7 @@ const DB_PATH: &str = ".bdk_esplora_example.db";
|
|||||||
|
|
||||||
type ChangeSet = (
|
type ChangeSet = (
|
||||||
local_chain::ChangeSet,
|
local_chain::ChangeSet,
|
||||||
indexed_tx_graph::ChangeSet<ConfirmationTimeAnchor, keychain::ChangeSet<Keychain>>,
|
indexed_tx_graph::ChangeSet<ConfirmationTimeHeightAnchor, keychain::ChangeSet<Keychain>>,
|
||||||
);
|
);
|
||||||
|
|
||||||
#[derive(Subcommand, Debug, Clone)]
|
#[derive(Subcommand, Debug, Clone)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user