Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# TODO fix, see: https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
enum-variant-size-threshold = 1032
# TODO fix, see: https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
large-error-threshold = 993
msrv = "1.63.0"
18 changes: 9 additions & 9 deletions wallet/src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ pub enum LoadMismatch {
/// Keychain identifying the descriptor.
keychain: KeychainKind,
/// The loaded descriptor.
loaded: Option<ExtendedDescriptor>,
loaded: Option<Box<ExtendedDescriptor>>,
/// The expected descriptor.
expected: Option<ExtendedDescriptor>,
expected: Option<Box<ExtendedDescriptor>>,
},
}

Expand Down Expand Up @@ -565,8 +565,8 @@ impl Wallet {
if descriptor.descriptor_id() != exp_desc.descriptor_id() {
return Err(LoadError::Mismatch(LoadMismatch::Descriptor {
keychain: KeychainKind::External,
loaded: Some(descriptor),
expected: Some(exp_desc),
loaded: Some(Box::new(descriptor)),
expected: Some(Box::new(exp_desc)),
}));
}
if params.extract_keys {
Expand All @@ -575,7 +575,7 @@ impl Wallet {
} else {
return Err(LoadError::Mismatch(LoadMismatch::Descriptor {
keychain: KeychainKind::External,
loaded: Some(descriptor),
loaded: Some(Box::new(descriptor)),
expected: None,
}));
}
Expand All @@ -595,7 +595,7 @@ impl Wallet {
return Err(LoadError::Mismatch(LoadMismatch::Descriptor {
keychain: KeychainKind::Internal,
loaded: None,
expected: Some(exp_desc),
expected: Some(Box::new(exp_desc)),
}));
}
}
Expand All @@ -609,7 +609,7 @@ impl Wallet {
None => {
return Err(LoadError::Mismatch(LoadMismatch::Descriptor {
keychain: KeychainKind::Internal,
loaded: Some(desc),
loaded: Some(Box::new(desc)),
expected: None,
}))
}
Expand All @@ -621,8 +621,8 @@ impl Wallet {
if desc.descriptor_id() != exp_desc.descriptor_id() {
return Err(LoadError::Mismatch(LoadMismatch::Descriptor {
keychain: KeychainKind::Internal,
loaded: Some(desc),
expected: Some(exp_desc),
loaded: Some(Box::new(desc)),
expected: Some(Box::new(exp_desc)),
}));
}
if params.extract_keys {
Expand Down
11 changes: 8 additions & 3 deletions wallet/src/wallet/persisted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ impl<P: WalletPersister> PersistedWallet<P> {
) -> Result<Self, CreateWithPersistError<P::Error>> {
let existing = P::initialize(persister).map_err(CreateWithPersistError::Persist)?;
if !existing.is_empty() {
return Err(CreateWithPersistError::DataAlreadyExists(existing));
return Err(CreateWithPersistError::DataAlreadyExists(Box::new(
existing,
)));
}
let mut inner =
Wallet::create_with_params(params).map_err(CreateWithPersistError::Descriptor)?;
Expand Down Expand Up @@ -207,7 +209,9 @@ impl<P: AsyncWalletPersister> PersistedWallet<P> {
.await
.map_err(CreateWithPersistError::Persist)?;
if !existing.is_empty() {
return Err(CreateWithPersistError::DataAlreadyExists(existing));
return Err(CreateWithPersistError::DataAlreadyExists(Box::new(
existing,
)));
}
let mut inner =
Wallet::create_with_params(params).map_err(CreateWithPersistError::Descriptor)?;
Expand Down Expand Up @@ -292,6 +296,7 @@ impl WalletPersister for bdk_chain::rusqlite::Connection {

/// Error for [`bdk_file_store`]'s implementation of [`WalletPersister`].
#[cfg(feature = "file_store")]
#[allow(clippy::large_enum_variant)] // Can be fixed in `bdk_file_store` by boxing the dump.
#[derive(Debug)]
pub enum FileStoreError {
/// Error when loading from the store.
Expand Down Expand Up @@ -357,7 +362,7 @@ pub enum CreateWithPersistError<E> {
/// Error from persistence.
Persist(E),
/// Persister already has wallet data.
DataAlreadyExists(ChangeSet),
DataAlreadyExists(Box<ChangeSet>),
/// Occurs when the loaded changeset cannot construct [`Wallet`].
Descriptor(DescriptorError),
}
Expand Down
1 change: 1 addition & 0 deletions wallet/tests/persisted_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ fn single_descriptor_wallet_persist_and_recover() {
// should error on wrong internal params
let desc = get_test_wpkh();
let (exp_desc, _) = <Descriptor<DescriptorPublicKey>>::parse_descriptor(secp, desc).unwrap();
let exp_desc = Box::new(exp_desc);
let err = Wallet::load()
.descriptor(KeychainKind::Internal, Some(desc))
.extract_keys()
Expand Down
Loading