Skip to content

Commit e078db2

Browse files
committed
Merge bitcoindevkit#382: refactor(wallet)!: Remove unused ApplyBlockError
20fea22 refactor: remove unused ApplyBlockError (thunderbiscuit) Pull request description: This was caught by ValuedMammal here: bitcoindevkit#378 (comment) ### Description This PR removes an unused error. An alternative could be to repurpose the type to be used as the error for the `apply_block*` methods, as it seems to be adequately named to go along with `Wallet::apply_block`. ### Changelog notice - Removed `ApplyBlockError` from the public API ### 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 `just p` before pushing #### New Features: * [ ] I've added tests for the new feature * [ ] I've added docs for the new feature #### Bugfixes: * [x] This pull request breaks the existing API * [ ] I've added tests to reproduce the issue which are now passing * [ ] I'm linking the issue being fixed by this PR ACKs for top commit: luisschwab: ACK 20fea22 evanlinjin: ACK 20fea22 110CodingP: ACK [20fea22](bitcoindevkit@20fea22) Tree-SHA512: 964ca874cce8778a7ca72a9bcc438894a9a422fd688ba9fbf61e580357e322dd05f17ee0c6ebedb746597342b6983d150120a32ce267418b7622f7960255ff63
2 parents f84cc23 + 20fea22 commit e078db2

2 files changed

Lines changed: 1 addition & 34 deletions

File tree

src/wallet/error.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use alloc::{
2020
string::{String, ToString},
2121
};
2222
use bitcoin::{absolute, psbt, Amount, BlockHash, Network, OutPoint, Sequence, Txid};
23-
use chain::local_chain::CannotConnectError;
2423
use core::fmt;
2524

2625
/// The error type when loading a [`Wallet`] from a [`ChangeSet`].
@@ -128,38 +127,6 @@ impl From<LoadMismatch> for LoadError {
128127
}
129128
}
130129

131-
/// An error that may occur when applying a block to [`Wallet`].
132-
#[derive(Debug)]
133-
pub enum ApplyBlockError {
134-
/// Occurs when the update chain cannot connect with original chain.
135-
CannotConnect(CannotConnectError),
136-
/// Occurs when the `connected_to` hash does not match the hash derived from `block`.
137-
UnexpectedConnectedToHash {
138-
/// Block hash of `connected_to`.
139-
connected_to_hash: BlockHash,
140-
/// Expected block hash of `connected_to`, as derived from `block`.
141-
expected_hash: BlockHash,
142-
},
143-
}
144-
145-
impl fmt::Display for ApplyBlockError {
146-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
147-
match self {
148-
ApplyBlockError::CannotConnect(err) => err.fmt(f),
149-
ApplyBlockError::UnexpectedConnectedToHash {
150-
expected_hash: block_hash,
151-
connected_to_hash: checkpoint_hash,
152-
} => write!(
153-
f,
154-
"`connected_to` hash {checkpoint_hash} differs from the expected hash {block_hash} (which is derived from `block`)"
155-
),
156-
}
157-
}
158-
}
159-
160-
#[cfg(feature = "std")]
161-
impl std::error::Error for ApplyBlockError {}
162-
163130
/// Errors returned by miniscript when updating inconsistent PSBTs
164131
#[derive(Debug, Clone)]
165132
pub enum MiniscriptPsbtError {

src/wallet/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ use crate::wallet::{
8080
// re-exports
8181
pub use bdk_chain::Balance;
8282
pub use changeset::ChangeSet;
83-
pub use error::{ApplyBlockError, LoadError, LoadMismatch};
83+
pub use error::{LoadError, LoadMismatch};
8484
pub use event::*;
8585
pub use params::*;
8686
pub use persisted::*;

0 commit comments

Comments
 (0)