Skip to content

Commit da2fe7b

Browse files
committed
fix failing CI tests
1 parent 528fde7 commit da2fe7b

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

crates/chain/src/indexed_tx_graph.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ where
8181
/// # Example
8282
///
8383
/// ```
84-
/// use bdk_chain::{IndexedTxGraph, keychain_txout::KeychainTxOutIndex};
84+
/// use bdk_chain::{IndexedTxGraph, keychain_txout::KeychainTxOutIndex, BlockId};
8585
///
86-
/// let index = KeychainTxOutIndex::<&str>::new(10);
87-
/// let graph = IndexedTxGraph::new(index);
86+
/// let index = KeychainTxOutIndex::<&str>::new(10, true);
87+
/// let graph = IndexedTxGraph::<BlockId, _>::new(index);
8888
/// ```
8989
pub fn new(index: I) -> Self {
9090
Self {
@@ -367,9 +367,9 @@ where
367367
/// use bdk_chain::{IndexedTxGraph, keychain_txout::KeychainTxOutIndex, BlockId};
368368
/// use bitcoin::Block;
369369
///
370-
/// let mut graph = IndexedTxGraph::<BlockId, _>::new(KeychainTxOutIndex::<&str>::new(10));
370+
/// let mut graph = IndexedTxGraph::<BlockId, _>::new(KeychainTxOutIndex::<&str>::new(10, true));
371371
/// # let block = Block { header: bitcoin::block::Header::from(bitcoin::constants::genesis_block(bitcoin::Network::Bitcoin).header), txdata: vec![] };
372-
///
372+
///
373373
/// let changeset = graph.apply_block_relevant(&block, 100);
374374
/// ```
375375
pub fn apply_block_relevant(

crates/chain/src/indexer/keychain_txout.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,11 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
461461
/// use bdk_chain::miniscript::{Descriptor, DescriptorPublicKey};
462462
/// # use std::str::FromStr;
463463
///
464-
/// let mut index = KeychainTxOutIndex::<&str>::new(10);
464+
/// let mut index = KeychainTxOutIndex::<&str>::new(10, true);
465465
/// let desc = Descriptor::<DescriptorPublicKey>::from_str(
466466
/// "wpkh([d34db33f/84h/0h/0h]xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0/*)"
467467
/// )?;
468-
///
468+
///
469469
/// index.insert_descriptor("external", desc)?;
470470
/// # Ok::<_, Box<dyn std::error::Error>>(())
471471
/// ```
@@ -855,10 +855,16 @@ impl<K: Clone + Ord + Debug> KeychainTxOutIndex<K> {
855855
///
856856
/// ```
857857
/// use bdk_chain::keychain_txout::KeychainTxOutIndex;
858+
/// use bdk_chain::miniscript::{Descriptor, DescriptorPublicKey};
859+
/// # use std::str::FromStr;
858860
///
859-
/// let mut index = KeychainTxOutIndex::<&str>::new(10);
860-
/// let (idx, spk, changeset) = index.reveal_next_spk("external").unwrap();
861-
/// assert_eq!(idx.0, 0);
861+
/// let mut index = KeychainTxOutIndex::<&str>::new(10, true);
862+
/// let desc = Descriptor::<DescriptorPublicKey>::from_str(
863+
/// "wpkh([d34db33f/84h/0h/0h]xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0/*)"
864+
/// ).unwrap();
865+
/// index.insert_descriptor("external", desc).unwrap();
866+
/// let (spk, changeset) = index.reveal_next_spk("external").unwrap();
867+
/// assert_eq!(spk.0, 0);
862868
/// ```
863869
pub fn reveal_next_spk(&mut self, keychain: K) -> Option<(Indexed<ScriptBuf>, ChangeSet)> {
864870
let mut changeset = ChangeSet::default();

crates/chain/src/tx_graph.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,10 @@ impl<A: Anchor> TxGraph<A> {
659659
/// # Example
660660
///
661661
/// ```
662-
/// use bdk_chain::tx_graph::TxGraph;
662+
/// use bdk_chain::{tx_graph::TxGraph, BlockId};
663663
/// use bitcoin::Transaction;
664664
///
665-
/// let mut graph = TxGraph::<()>::default();
665+
/// let mut graph = TxGraph::<BlockId>::default();
666666
/// let tx = Transaction {
667667
/// version: bitcoin::transaction::Version::ONE,
668668
/// lock_time: bitcoin::locktime::absolute::LockTime::ZERO,
@@ -1275,12 +1275,12 @@ impl<A: Anchor> TxGraph<A> {
12751275
///
12761276
/// let mut graph = TxGraph::<BlockId>::default();
12771277
/// let chain = LocalChain::from_blocks([
1278-
/// (0, BlockId { height: 0, hash: bitcoin::constants::genesis_block(bitcoin::Network::Bitcoin).block_hash() })
1279-
/// ].into_iter().collect());
1278+
/// (0, bitcoin::constants::genesis_block(bitcoin::Network::Bitcoin).block_hash())
1279+
/// ].into_iter().collect()).unwrap();
12801280
///
12811281
/// // Get unspent outputs
12821282
/// let outpoints = vec![(0, OutPoint::default())];
1283-
/// let utxos: Vec<_> = graph.filter_chain_unspents(&chain, chain.tip(), CanonicalizationParams::default(), outpoints).collect();
1283+
/// let utxos: Vec<_> = graph.filter_chain_unspents(&chain, chain.tip().block_id(), CanonicalizationParams::default(), outpoints).collect();
12841284
/// ```
12851285
///
12861286
/// [`try_filter_chain_unspents`]: Self::try_filter_chain_unspents
@@ -1360,11 +1360,11 @@ impl<A: Anchor> TxGraph<A> {
13601360
///
13611361
/// let graph = TxGraph::<BlockId>::default();
13621362
/// let chain = LocalChain::from_blocks([
1363-
/// (0, BlockId { height: 0, hash: bitcoin::constants::genesis_block(bitcoin::Network::Bitcoin).block_hash() })
1364-
/// ].into_iter().collect());
1365-
///
1363+
/// (0, bitcoin::constants::genesis_block(bitcoin::Network::Bitcoin).block_hash())
1364+
/// ].into_iter().collect()).unwrap();
1365+
///
13661366
/// let outpoints = vec![(0, OutPoint::default())];
1367-
/// let balance = graph.balance(&chain, chain.tip(), CanonicalizationParams::default(), outpoints, |_, _| true);
1367+
/// let balance = graph.balance(&chain, chain.tip().block_id(), CanonicalizationParams::default(), outpoints, |_, _| true);
13681368
/// ```
13691369
///
13701370
/// [`try_balance`]: Self::try_balance

0 commit comments

Comments
 (0)