Skip to content

Commit f809a7e

Browse files
committed
test: add more tests for createtx, bip322
- add tests for OP_RETURN in createtx - add tests for coin selection in createtx - add test for esplora client full_scan - fix clippy issues
1 parent a993315 commit f809a7e

4 files changed

Lines changed: 348 additions & 19 deletions

File tree

src/handlers/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::config::{WalletConfig, WalletConfigInner};
1212
use crate::error::BDKCliError as Error;
1313
use crate::handlers::Init;
1414
use crate::handlers::{AppCommand, AppContext};
15-
#[cfg(feature = "sqlite")]
15+
#[cfg(any(feature = "sqlite", feature = "redb"))]
1616
use crate::persister::DatabaseType;
1717
use crate::utils::types::{StatusResult, WalletsListResult};
1818
use bdk_wallet::bitcoin::Network;

src/persister.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ use bdk_wallet::Wallet;
44
use bdk_wallet::bitcoin::Network;
55
#[cfg(any(feature = "sqlite", feature = "redb"))]
66
use bdk_wallet::{KeychainKind, PersistedWallet, WalletPersister};
7+
#[cfg(any(feature = "sqlite", feature = "redb"))]
78
use clap::ValueEnum;
89

10+
#[cfg(any(feature = "sqlite", feature = "redb"))]
911
#[derive(Clone, ValueEnum, Debug, Eq, PartialEq)]
1012
pub enum DatabaseType {
1113
/// Sqlite database

src/utils/runtime.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,28 @@ impl WalletRuntime {
8989
})
9090
}
9191

92-
pub fn build_wallet(&self, require_db: bool) -> Result<RuntimeWallet, Error> {
93-
if !require_db {
94-
return Ok(RuntimeWallet::Standard(Box::new(new_wallet(
95-
self.network,
96-
&self.wallet_opts,
97-
)?)));
98-
}
99-
92+
pub fn build_wallet(
93+
&self,
94+
#[cfg_attr(
95+
not(any(feature = "sqlite", feature = "redb")),
96+
allow(unused_variables)
97+
)]
98+
require_db: bool,
99+
) -> Result<RuntimeWallet, Error> {
100100
#[cfg(any(feature = "sqlite", feature = "redb"))]
101-
{
101+
if require_db {
102102
let mut persister = self.create_persister()?;
103103
let wallet = new_persisted_wallet(self.network, &mut persister, &self.wallet_opts)?;
104-
Ok(RuntimeWallet::Persisted(
104+
return Ok(RuntimeWallet::Persisted(
105105
Box::new(wallet),
106106
Box::new(persister),
107-
))
107+
));
108108
}
109109

110-
#[cfg(not(any(feature = "sqlite", feature = "redb")))]
111-
{
112-
Ok(RuntimeWallet::Standard(Box::new(new_wallet(
113-
self.network,
114-
&self.wallet_opts,
115-
)?)))
116-
}
110+
Ok(RuntimeWallet::Standard(Box::new(new_wallet(
111+
self.network,
112+
&self.wallet_opts,
113+
)?)))
117114
}
118115

119116
#[cfg(any(

0 commit comments

Comments
 (0)