Skip to content

Commit 4ae727a

Browse files
committed
[chain_redesign] Relax generic constraints
1 parent 085bf94 commit 4ae727a

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

crates/chain/src/indexed_tx_graph.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::{
1212
/// A struct that combines [`TxGraph`] and an [`Indexer`] implementation.
1313
///
1414
/// This structure ensures that [`TxGraph`] and [`Indexer`] are updated atomically.
15+
#[derive(Debug)]
1516
pub struct IndexedTxGraph<A, I> {
1617
/// Transaction index.
1718
pub index: I,
@@ -27,12 +28,14 @@ impl<A, I: Default> Default for IndexedTxGraph<A, I> {
2728
}
2829
}
2930

30-
impl<A: Anchor, I: Indexer> IndexedTxGraph<A, I> {
31+
impl<A, I> IndexedTxGraph<A, I> {
3132
/// Get a reference of the internal transaction graph.
3233
pub fn graph(&self) -> &TxGraph<A> {
3334
&self.graph
3435
}
36+
}
3537

38+
impl<A: Anchor, I: Indexer> IndexedTxGraph<A, I> {
3639
/// Applies the [`IndexedAdditions`] to the [`IndexedTxGraph`].
3740
pub fn apply_additions(&mut self, additions: IndexedAdditions<A, I::Additions>) {
3841
let IndexedAdditions {
@@ -217,7 +220,7 @@ impl<A: Anchor, I: OwnedIndexer> IndexedTxGraph<A, I> {
217220
C: ChainOracle,
218221
F: FnMut(&Script) -> bool,
219222
{
220-
let tip_height = chain_tip.anchor_block().height;
223+
let tip_height = chain_tip.height;
221224

222225
let mut immature = 0;
223226
let mut trusted_pending = 0;

crates/chain/src/keychain/txout_index.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<K> Deref for KeychainTxOutIndex<K> {
8989
}
9090
}
9191

92-
impl<K: Clone + Ord + Debug + 'static> Indexer for KeychainTxOutIndex<K> {
92+
impl<K: Clone + Ord + Debug> Indexer for KeychainTxOutIndex<K> {
9393
type Additions = DerivationAdditions<K>;
9494

9595
fn index_txout(&mut self, outpoint: OutPoint, txout: &TxOut) -> Self::Additions {
@@ -109,9 +109,9 @@ impl<K: Clone + Ord + Debug + 'static> Indexer for KeychainTxOutIndex<K> {
109109
}
110110
}
111111

112-
impl<K: Clone + Ord + Debug + 'static> OwnedIndexer for KeychainTxOutIndex<K> {
112+
impl<K: Clone + Ord + Debug> OwnedIndexer for KeychainTxOutIndex<K> {
113113
fn is_spk_owned(&self, spk: &Script) -> bool {
114-
self.inner().is_spk_owned(spk)
114+
self.index_of_spk(spk).is_some()
115115
}
116116
}
117117

crates/chain/src/spk_txout_index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<I> Default for SpkTxOutIndex<I> {
5353
}
5454
}
5555

56-
impl<I: Clone + Ord + 'static> Indexer for SpkTxOutIndex<I> {
56+
impl<I: Clone + Ord> Indexer for SpkTxOutIndex<I> {
5757
type Additions = ();
5858

5959
fn index_txout(&mut self, outpoint: OutPoint, txout: &TxOut) -> Self::Additions {

0 commit comments

Comments
 (0)