• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bitcoindevkit / bdk / 5984736767

26 Aug 2023 12:20PM UTC coverage: 78.856% (+0.2%) from 78.694%
5984736767

Pull #1084

github

web-flow
Merge 8bdb5a43d into 8f978f86b
Pull Request #1084: Enhance bdk chain structures

86 of 86 new or added lines in 5 files covered. (100.0%)

8022 of 10173 relevant lines covered (78.86%)

5091.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.0
/crates/chain/src/lib.rs
1
//! This crate is a collection of core structures for [Bitcoin Dev Kit] (alpha release).
1✔
2
//!
3
//! The goal of this crate is to give wallets the mechanisms needed to:
4
//!
5
//! 1. Figure out what data they need to fetch.
6
//! 2. Process the data in a way that never leads to inconsistent states.
7
//! 3. Fully index that data and expose it to be consumed without friction.
8
//!
9
//! Our design goals for these mechanisms are:
10
//!
11
//! 1. Data source agnostic -- nothing in `bdk_chain` cares about where you get data from or whether
12
//!    you do it synchronously or asynchronously. If you know a fact about the blockchain, you can just
13
//!    tell `bdk_chain`'s APIs about it, and that information will be integrated, if it can be done
14
//!    consistently.
15
//! 2. Error-free APIs.
16
//! 3. Data persistence agnostic -- `bdk_chain` does not care where you cache on-chain data, what you
17
//!    cache or how you fetch it.
18
//!
19
//! [Bitcoin Dev Kit]: https://bitcoindevkit.org/
20

21
#![no_std]
22
#![warn(missing_docs)]
23

24
pub use bitcoin;
25
mod spk_txout_index;
26
pub use spk_txout_index::*;
27
mod chain_data;
28
pub use chain_data::*;
29
pub mod indexed_tx_graph;
30
pub use indexed_tx_graph::IndexedTxGraph;
31
pub mod keychain;
32
pub mod local_chain;
33
mod tx_data_traits;
34
pub mod tx_graph;
35
pub use tx_data_traits::*;
36
pub use tx_graph::TxGraph;
37
mod chain_oracle;
38
pub use chain_oracle::*;
39
mod persist;
40
pub use persist::*;
41

42
#[doc(hidden)]
43
pub mod example_utils;
44

45
#[cfg(feature = "miniscript")]
46
pub use miniscript;
47
#[cfg(feature = "miniscript")]
48
mod descriptor_ext;
49
#[cfg(feature = "miniscript")]
50
pub use descriptor_ext::DescriptorExt;
51
#[cfg(feature = "miniscript")]
52
mod spk_iter;
53
#[cfg(feature = "miniscript")]
54
pub use spk_iter::*;
55

56
#[allow(unused_imports)]
57
#[macro_use]
58
extern crate alloc;
59

60
#[cfg(feature = "serde")]
61
pub extern crate serde_crate as serde;
62

63
#[cfg(feature = "bincode")]
64
extern crate bincode;
65

66
#[cfg(feature = "std")]
67
#[macro_use]
68
extern crate std;
69

70
#[cfg(all(not(feature = "std"), feature = "hashbrown"))]
71
extern crate hashbrown;
72

73
// When no-std use `alloc`'s Hash collections. This is activated by default
74
#[cfg(all(not(feature = "std"), not(feature = "hashbrown")))]
75
#[doc(hidden)]
76
pub mod collections {
77
    #![allow(dead_code)]
78
    pub type HashSet<K> = alloc::collections::BTreeSet<K>;
79
    pub type HashMap<K, V> = alloc::collections::BTreeMap<K, V>;
80
    pub use alloc::collections::{btree_map as hash_map, *};
81
}
82

83
// When we have std, use `std`'s all collections
84
#[cfg(all(feature = "std", not(feature = "hashbrown")))]
85
#[doc(hidden)]
86
pub mod collections {
87
    pub use std::collections::{hash_map, *};
88
}
89

90
// With this special feature `hashbrown`, use `hashbrown`'s hash collections, and else from `alloc`.
91
#[cfg(feature = "hashbrown")]
92
#[doc(hidden)]
93
pub mod collections {
94
    #![allow(dead_code)]
95
    pub type HashSet<K> = hashbrown::HashSet<K>;
96
    pub type HashMap<K, V> = hashbrown::HashMap<K, V>;
97
    pub use alloc::collections::*;
98
    pub use hashbrown::hash_map;
99
}
100

101
/// How many confirmations are needed f or a coinbase output to be spent.
102
pub const COINBASE_MATURITY: u32 = 100;
103

104
impl<A, IA> From<indexed_tx_graph::ChangeSet<A, IA>>
105
    for (local_chain::ChangeSet, indexed_tx_graph::ChangeSet<A, IA>)
106
{
107
    fn from(indexed_changeset: indexed_tx_graph::ChangeSet<A, IA>) -> Self {
×
108
        (local_chain::ChangeSet::default(), indexed_changeset)
×
109
    }
×
110
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc