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

bitcoindevkit / bdk / 8968819480

06 May 2024 12:09PM UTC coverage: 82.273%. Remained the same
8968819480

push

github

evanlinjin
Merge bitcoindevkit/bdk#1427: docs(esplora): fixed `full_scan` and `sync` documentation

<a class=hub.com/bitcoindevkit/bdk/commit/<a class="double-link" href="https://git"><a class=hub.com/bitcoindevkit/bdk/commit/f6dc6890c37752e80c86c68ae3ca3cc4fac6245e">f6dc6890c docs(esplora): fixed `full_scan` and `sync` documentation (Wei Chen)

Pull request description:

  <!-- You can erase any parts of this template not applicable to your Pull Request. -->

  ### Description

  Fixed documentation for `full_scan` and `sync` in `bdk_esplora`.

  ### Changelog notice

  <!-- Notice the release manager should include in the release tag message changelog -->
  <!-- See https://keepachangelog.com/en/1.0.0/ for examples -->
  * Updated documentation for `full_scan` and `sync` in `bdk_esplora`.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  evanlinjin:
    ACK f6dc6890c37752e80c86c68ae3ca3cc4fac6245e
  storopoli:
    ACK f6dc6890c37752e80c86c68ae3ca3cc4fac6245e

Tree-SHA512: 900fb1a280a72ee1e13c5c70a136b93f332

10396 of 12636 relevant lines covered (82.27%)

17655.35 hits per line

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

6.52
/crates/bdk/src/descriptor/error.rs
1
// Bitcoin Dev Kit
2
// Written in 2020 by Alekos Filini <alekos.filini@gmail.com>
3
//
4
// Copyright (c) 2020-2021 Bitcoin Dev Kit Developers
5
//
6
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
7
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
9
// You may not use this file except in accordance with one or both of these
10
// licenses.
11

12
//! Descriptor errors
13
use core::fmt;
14

15
/// Errors related to the parsing and usage of descriptors
16
#[derive(Debug)]
17
pub enum Error {
18
    /// Invalid HD Key path, such as having a wildcard but a length != 1
19
    InvalidHdKeyPath,
20
    /// The provided descriptor doesn't match its checksum
21
    InvalidDescriptorChecksum,
22
    /// The descriptor contains hardened derivation steps on public extended keys
23
    HardenedDerivationXpub,
24
    /// The descriptor contains multipath keys
25
    MultiPath,
26

27
    /// Error thrown while working with [`keys`](crate::keys)
28
    Key(crate::keys::KeyError),
29
    /// Error while extracting and manipulating policies
30
    Policy(crate::descriptor::policy::PolicyError),
31

32
    /// Invalid byte found in the descriptor checksum
33
    InvalidDescriptorCharacter(u8),
34

35
    /// BIP32 error
36
    Bip32(bitcoin::bip32::Error),
37
    /// Error during base58 decoding
38
    Base58(bitcoin::base58::Error),
39
    /// Key-related error
40
    Pk(bitcoin::key::Error),
41
    /// Miniscript error
42
    Miniscript(miniscript::Error),
43
    /// Hex decoding error
44
    Hex(bitcoin::hex::HexToBytesError),
45
}
46

47
impl From<crate::keys::KeyError> for Error {
48
    fn from(key_error: crate::keys::KeyError) -> Error {
×
49
        match key_error {
×
50
            crate::keys::KeyError::Miniscript(inner) => Error::Miniscript(inner),
×
51
            crate::keys::KeyError::Bip32(inner) => Error::Bip32(inner),
×
52
            e => Error::Key(e),
×
53
        }
54
    }
×
55
}
56

57
impl fmt::Display for Error {
58
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
×
59
        match self {
×
60
            Self::InvalidHdKeyPath => write!(f, "Invalid HD key path"),
×
61
            Self::InvalidDescriptorChecksum => {
62
                write!(f, "The provided descriptor doesn't match its checksum")
×
63
            }
64
            Self::HardenedDerivationXpub => write!(
×
65
                f,
×
66
                "The descriptor contains hardened derivation steps on public extended keys"
×
67
            ),
×
68
            Self::MultiPath => write!(
×
69
                f,
×
70
                "The descriptor contains multipath keys, which are not supported yet"
×
71
            ),
×
72
            Self::Key(err) => write!(f, "Key error: {}", err),
×
73
            Self::Policy(err) => write!(f, "Policy error: {}", err),
×
74
            Self::InvalidDescriptorCharacter(char) => {
×
75
                write!(f, "Invalid descriptor character: {}", char)
×
76
            }
77
            Self::Bip32(err) => write!(f, "BIP32 error: {}", err),
×
78
            Self::Base58(err) => write!(f, "Base58 error: {}", err),
×
79
            Self::Pk(err) => write!(f, "Key-related error: {}", err),
×
80
            Self::Miniscript(err) => write!(f, "Miniscript error: {}", err),
×
81
            Self::Hex(err) => write!(f, "Hex decoding error: {}", err),
×
82
        }
83
    }
×
84
}
85

86
#[cfg(feature = "std")]
87
impl std::error::Error for Error {}
88

89
impl From<bitcoin::bip32::Error> for Error {
90
    fn from(err: bitcoin::bip32::Error) -> Self {
×
91
        Error::Bip32(err)
×
92
    }
×
93
}
94

95
impl From<bitcoin::base58::Error> for Error {
96
    fn from(err: bitcoin::base58::Error) -> Self {
×
97
        Error::Base58(err)
×
98
    }
×
99
}
100

101
impl From<bitcoin::key::Error> for Error {
102
    fn from(err: bitcoin::key::Error) -> Self {
×
103
        Error::Pk(err)
×
104
    }
×
105
}
106

107
impl From<miniscript::Error> for Error {
108
    fn from(err: miniscript::Error) -> Self {
2✔
109
        Error::Miniscript(err)
2✔
110
    }
2✔
111
}
112

113
impl From<bitcoin::hex::HexToBytesError> for Error {
114
    fn from(err: bitcoin::hex::HexToBytesError) -> Self {
×
115
        Error::Hex(err)
×
116
    }
×
117
}
118

119
impl From<crate::descriptor::policy::PolicyError> for Error {
120
    fn from(err: crate::descriptor::policy::PolicyError) -> Self {
×
121
        Error::Policy(err)
×
122
    }
×
123
}
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