Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

liana: remove daemon feature #1469

Merged
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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions contrib/lianad_config_example.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Whether to run the process as a UNIX daemon (double fork magic)
daemon = false

# (Optional) Path to the folder where we should store the application data.
# Defaults to `.lianad` in your home folder.
data_dir = "/home/wizardsardine/.lianad"
Expand Down
7 changes: 0 additions & 7 deletions liana/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@ exclude = [".github/", ".cirrus.yml", "tests/", "test_data/", "contrib/", "pypr
[[bin]]
name = "lianad"
path = "src/bin/daemon.rs"
required-features = ["daemon"]

[[bin]]
name = "liana-cli"
path = "src/bin/cli.rs"
required-features = ["daemon"]

[features]
default = ["daemon"]
daemon = ["libc"]
nonblocking_shutdown = []

[dependencies]
Expand Down Expand Up @@ -59,9 +55,6 @@ rusqlite = { version = "0.30", features = ["bundled", "unlock_notify"] }
# To talk to bitcoind
jsonrpc = { version = "0.17", features = ["minreq_http"], default-features = false }

# Used for daemonization
libc = { version = "0.2", optional = true }

# Used for generating mnemonics
getrandom = "0.2"

Expand Down
7 changes: 1 addition & 6 deletions liana/src/bin/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,7 @@ fn main() {
process::exit(1);
});

let handle = DaemonHandle::start_default(
config,
#[cfg(all(unix, feature = "daemon"))]
true,
)
.unwrap_or_else(|e| {
let handle = DaemonHandle::start_default(config, cfg!(unix)).unwrap_or_else(|e| {
log::error!("Error starting Liana daemon: {}", e);
process::exit(1);
});
Expand Down
19 changes: 0 additions & 19 deletions liana/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ fn default_poll_interval() -> Duration {
Duration::from_secs(30)
}

#[cfg(unix)]
fn default_daemon() -> bool {
false
}

/// Bitcoin backend config.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub enum BitcoinBackend {
Expand Down Expand Up @@ -153,10 +148,6 @@ pub struct BitcoinConfig {
pub struct Config {
/// An optional custom data directory
pub data_dir: Option<PathBuf>,
/// Whether to daemonize the process
#[cfg(unix)]
#[serde(default = "default_daemon")]
pub daemon: bool,
/// What messages to log
#[serde(
deserialize_with = "deserialize_fromstr",
Expand Down Expand Up @@ -303,7 +294,6 @@ mod tests {
// A valid config
let toml_str = r#"
data_dir = "/home/wizardsardine/custom/folder/"
daemon = false
log_level = "debug"
main_descriptor = "wsh(andor(pk([aabbccdd]tpubDEN9WSToTyy9ZQfaYqSKfmVqmq1VVLNtYfj3Vkqh67et57eJ5sTKZQBkHqSwPUsoSskJeaYnPttHe2VrkCsKA27kUaN9SDc5zhqeLzKa1rr/<0;1>/*),older(10000),pk([aabbccdd]tpubD8LYfn6njiA2inCoxwM7EuN3cuLVcaHAwLYeups13dpevd3nHLRdK9NdQksWXrhLQVxcUZRpnp5CkJ1FhE61WRAsHxDNAkvGkoQkAeWDYjV/<0;1>/*)))#dw4ulnrs"

Expand All @@ -318,11 +308,9 @@ mod tests {
toml::from_str::<Config>(&toml_str).expect("Deserializing toml_str");

// A valid, round-tripping, config
#[cfg(unix)] // On non-UNIX there is no 'daemon' member.
{
let toml_str = r#"
data_dir = '/home/wizardsardine/custom/folder/'
daemon = false
edouardparis marked this conversation as resolved.
Show resolved Hide resolved
log_level = 'TRACE'
main_descriptor = 'wsh(andor(pk([aabbccdd]tpubDEN9WSToTyy9ZQfaYqSKfmVqmq1VVLNtYfj3Vkqh67et57eJ5sTKZQBkHqSwPUsoSskJeaYnPttHe2VrkCsKA27kUaN9SDc5zhqeLzKa1rr/<0;1>/*),older(10000),pk([aabbccdd]tpubD8LYfn6njiA2inCoxwM7EuN3cuLVcaHAwLYeups13dpevd3nHLRdK9NdQksWXrhLQVxcUZRpnp5CkJ1FhE61WRAsHxDNAkvGkoQkAeWDYjV/<0;1>/*)))#dw4ulnrs'

Expand All @@ -340,12 +328,9 @@ mod tests {
}

// A valid, round-tripping, config for a Taproot descriptor.

#[cfg(unix)] // On non-UNIX there is no 'daemon' member.
{
let toml_str = r#"
data_dir = '/home/wizardsardine/custom/folder/'
daemon = false
log_level = 'TRACE'
main_descriptor = 'tr([abcdef01]xpub6Eze7yAT3Y1wGrnzedCNVYDXUqa9NmHVWck5emBaTbXtURbe1NWZbK9bsz1TiVE7Cz341PMTfYgFw1KdLWdzcM1UMFTcdQfCYhhXZ2HJvTW/<0;1>/*,and_v(v:pk([abcdef01]xpub688Hn4wScQAAiYJLPg9yH27hUpfZAUnmJejRQBCiwfP5PEDzjWMNW1wChcninxr5gyavFqbbDjdV1aK5USJz8NDVjUy7FRQaaqqXHh5SbXe/<0;1>/*),older(52560)))#0mt7e93c'

Expand All @@ -363,11 +348,9 @@ mod tests {
}

// A valid, round-tripping, config with `auth` instead of `cookie_path`
#[cfg(unix)] // On non-UNIX there is no 'daemon' member.
{
let toml_str = r#"
data_dir = '/home/wizardsardine/custom/folder/'
daemon = false
log_level = 'TRACE'
main_descriptor = 'wsh(andor(pk([aabbccdd]tpubDEN9WSToTyy9ZQfaYqSKfmVqmq1VVLNtYfj3Vkqh67et57eJ5sTKZQBkHqSwPUsoSskJeaYnPttHe2VrkCsKA27kUaN9SDc5zhqeLzKa1rr/<0;1>/*),older(10000),pk([aabbccdd]tpubD8LYfn6njiA2inCoxwM7EuN3cuLVcaHAwLYeups13dpevd3nHLRdK9NdQksWXrhLQVxcUZRpnp5CkJ1FhE61WRAsHxDNAkvGkoQkAeWDYjV/<0;1>/*)))#dw4ulnrs'

Expand All @@ -386,7 +369,6 @@ mod tests {

// Invalid desc checksum
let toml_str = r#"
daemon = false
log_level = "trace"
data_dir = "/home/wizardsardine/custom/folder/"

Expand All @@ -405,7 +387,6 @@ mod tests {

// Not enough parameters: missing the Bitcoin network
let toml_str = r#"
daemon = false
log_level = "trace"
data_dir = "/home/wizardsardine/custom/folder/"

Expand Down
69 changes: 0 additions & 69 deletions liana/src/daemonize.rs

This file was deleted.

2 changes: 1 addition & 1 deletion liana/src/jsonrpc/api.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
commands::{CoinStatus, LabelItem},
jsonrpc::{Error, Params, Request, Response},
jsonrpc::rpc::{Error, Params, Request, Response},
DaemonControl,
};

Expand Down
Loading
Loading