Merge #166: deps: make libc optional

4bf5234ce97fa725c076be628c12b7289466c1f1 Cargo.lock: update libc (Antoine Poinsot)
6ea9ba5c1c661eb26edd17212dd34459a006a981 Cargo: get rid of the jsonrpc_server feature. (Antoine Poinsot)
cc8844671773e2fbfe0c17fdf504ff2bed769413 deps: make libc optional (edouard)

Pull request description:

ACKs for top commit:
  darosior:
    ACK 4bf5234ce97fa725c076be628c12b7289466c1f1

Tree-SHA512: 0d754d8201c74b88edc5bf1166bd8ff33a25fd4490e58d3a6f23bbf3a7970881706181228e17683cd7030d7ae94ebbcff0bbcfaa42a96fdc684fbbaca58a1d58
This commit is contained in:
Antoine Poinsot 2023-03-24 17:59:29 +01:00
commit 7279a3205e
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
4 changed files with 13 additions and 13 deletions

4
Cargo.lock generated
View File

@ -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"

View File

@ -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"

View File

@ -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,

View File

@ -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)?;