diff --git a/Cargo.lock b/Cargo.lock index fee56107..e4a1dc7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -244,9 +244,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.135" +version = "0.2.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" [[package]] name = "libsqlite3-sys" diff --git a/Cargo.toml b/Cargo.toml index 9258c5c8..24fe82b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ exclude = [".github/", ".cirrus.yml", "tests/", "test_data/", "contrib/", "pypr [[bin]] name = "lianad" path = "src/bin/daemon.rs" -required-features = ["jsonrpc_server"] +required-features = ["daemon"] [[bin]] name = "liana-cli" path = "src/bin/cli.rs" -required-features = ["jsonrpc_server"] +required-features = ["daemon"] [features] -default = ["jsonrpc_server"] -jsonrpc_server = [] +default = ["daemon"] +daemon = ["libc"] [dependencies] # For managing transactions (it re-exports the bitcoin crate) @@ -52,7 +52,7 @@ rusqlite = { version = "0.26.3", features = ["bundled", "unlock_notify"] } jsonrpc = "0.12" # Used for daemonization -libc = "0.2" +libc = { version = "0.2", optional = true } # Used for PSBTs base64 = "0.13" diff --git a/src/lib.rs b/src/lib.rs index bee7934d..19f78541 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,11 @@ mod bitcoin; pub mod commands; pub mod config; -#[cfg(unix)] +#[cfg(all(unix, feature = "daemon"))] mod daemonize; mod database; pub mod descriptors; -#[cfg(feature = "jsonrpc_server")] +#[cfg(feature = "daemon")] mod jsonrpc; mod random; pub mod signer; @@ -16,7 +16,7 @@ pub use bip39; pub use miniscript; pub use crate::bitcoin::d::{BitcoindError, WalletError}; -#[cfg(feature = "jsonrpc_server")] +#[cfg(feature = "daemon")] use crate::jsonrpc::server::{rpcserver_loop, rpcserver_setup}; use crate::{ bitcoin::{d::BitcoinD, poller, BitcoinInterface}, @@ -381,7 +381,7 @@ impl DaemonHandle { // If we are on a UNIX system and they told us to daemonize, do it now. // NOTE: it's safe to daemonize now, as we don't carry any open DB connection // https://www.sqlite.org/howtocorrupt.html#_carrying_an_open_database_connection_across_a_fork_ - #[cfg(unix)] + #[cfg(all(unix, feature = "daemon"))] if config.daemon { log::info!("Daemonizing"); let log_file = data_dir.as_path().join("log"); @@ -417,7 +417,7 @@ impl DaemonHandle { /// Start the JSONRPC server and listen for incoming commands until we die. /// Like DaemonHandle::shutdown(), this stops the Bitcoin poller at teardown. - #[cfg(feature = "jsonrpc_server")] + #[cfg(feature = "daemon")] pub fn rpc_server(self) -> Result<(), io::Error> { let DaemonHandle { control, diff --git a/src/testutils.rs b/src/testutils.rs index dcdb1018..400141a6 100644 --- a/src/testutils.rs +++ b/src/testutils.rs @@ -416,7 +416,7 @@ impl DummyLiana { DummyLiana { tmp_dir, handle } } - #[cfg(feature = "jsonrpc_server")] + #[cfg(feature = "daemon")] pub fn rpc_server(self) -> Result<(), io::Error> { self.handle.rpc_server()?; fs::remove_dir_all(&self.tmp_dir)?;