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

bitcoindevkit / bdk / 5363628790

pending completion
5363628790

Pull #1002

github

web-flow
Merge 64e8b2e32 into 5d1f922b3
Pull Request #1002: Implement linked-list `LocalChain` and add rpc-chain module/example

623 of 623 new or added lines in 9 files covered. (100.0%)

7904 of 10206 relevant lines covered (77.44%)

5065.64 hits per line

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

3.57
/crates/esplora/src/lib.rs
1
#![doc = include_str!("../README.md")]
1✔
2
use std::collections::BTreeMap;
3

4
use bdk_chain::{local_chain::CheckPoint, ConfirmationTimeAnchor};
5
use esplora_client::TxStatus;
6

7
pub use esplora_client;
8

9
#[cfg(feature = "blocking")]
10
mod blocking_ext;
11
#[cfg(feature = "blocking")]
12
pub use blocking_ext::*;
13

14
#[cfg(feature = "async")]
15
mod async_ext;
16
#[cfg(feature = "async")]
17
pub use async_ext::*;
18

19
pub(crate) fn map_confirmation_time_anchor(
20
    tx_status: &TxStatus,
21
    tip: &CheckPoint,
22
) -> Option<ConfirmationTimeAnchor> {
23
    match (tx_status.block_time, tx_status.block_height) {
×
24
        (Some(confirmation_time), Some(confirmation_height)) => Some(ConfirmationTimeAnchor {
×
25
            anchor_block: tip.block_id(),
×
26
            confirmation_height,
×
27
            confirmation_time,
×
28
        }),
×
29
        _ => None,
×
30
    }
31
}
×
32

33
pub(crate) fn confirmation_time_anchor_maker(
×
34
    tip: &CheckPoint,
×
35
) -> impl FnMut(&TxStatus) -> Option<ConfirmationTimeAnchor> {
×
36
    let cache = tip
×
37
        .iter()
×
38
        .take(10)
×
39
        .map(|cp| (cp.height(), cp))
×
40
        .collect::<BTreeMap<u32, CheckPoint>>();
×
41

42
    move |status| match (status.block_time, status.block_height) {
×
43
        (Some(confirmation_time), Some(confirmation_height)) => {
×
44
            let (_, anchor_cp) = cache.range(confirmation_height..).next()?;
×
45

46
            Some(ConfirmationTimeAnchor {
×
47
                anchor_block: anchor_cp.block_id(),
×
48
                confirmation_height,
×
49
                confirmation_time,
×
50
            })
×
51
        }
52
        _ => None,
×
53
    }
×
54
}
×
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