Skip to content

Commit

Permalink
daemon: rename Minisafe to Liana
Browse files Browse the repository at this point in the history
  • Loading branch information
darosior committed Nov 17, 2022
1 parent 4bd6521 commit 968a7d1
Show file tree
Hide file tree
Showing 23 changed files with 280 additions and 280 deletions.
4 changes: 2 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ task:
fingerprint_script:
- rustc --version
- cat Cargo.lock
minisafed_build_script: cargo build --release
lianad_build_script: cargo build --release

deps_script: apt update && apt install -y python3 python3-pip

Expand All @@ -50,6 +50,6 @@ task:
export BITCOIND_PATH=bitcoin-24.0rc1/bin/bitcoind
# Run the functional tests
MINISAFED_PATH=$PWD/target/release/minisafed pytest $TEST_GROUP -vvv -n 2
LIANAD_PATH=$PWD/target/release/lianad pytest $TEST_GROUP -vvv -n 2
before_cache_script: rm -rf $CARGO_HOME/registry/index
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- nightly
os:
- ubuntu-latest
# See issue https://github.com/revault/minisafe/issues/69
# See issue https://github.com/revault/liana/issues/69
#- macOS-latest
- windows-latest
runs-on: ${{ matrix.os }}
Expand Down
36 changes: 18 additions & 18 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[package]
name = "minisafe"
name = "liana"
version = "0.0.1"
authors = ["Antoine Poinsot <[email protected]>"]
edition = "2018"
repository = "https://github.com/revault/minisafed"
repository = "https://github.com/revault/liana"
license-file = "LICENCE"
keywords = ["bitcoin", "wallet", "safe", "script", "miniscript", "inheritance", "recovery"]
description = "Minisafe wallet daemon"
description = "Liana wallet daemon"
exclude = [".github/", ".cirrus.yml", "tests/", "test_data/", "contrib/", "pyproject.toml"]

[[bin]]
name = "minisafed"
name = "lianad"
path = "src/bin/daemon.rs"
required-features = ["jsonrpc_server"]

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

Expand Down
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022, The Minisafe developers
Copyright (c) 2022, The Liana developers
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
10 changes: 5 additions & 5 deletions src/bin/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use minisafe::config::{config_folder_path, Config};
use liana::config::{config_folder_path, Config};

use std::{
env,
Expand All @@ -14,7 +14,7 @@ use std::os::unix::net::UnixStream;
// Exits with error
fn show_usage() {
eprintln!("Usage:");
eprintln!(" minisafe-cli [--conf conf_path] [--raw] <command> [<param 1> <param 2> ...]");
eprintln!(" liana-cli [--conf conf_path] [--raw] <command> [<param 1> <param 2> ...]");
process::exit(1);
}

Expand Down Expand Up @@ -73,7 +73,7 @@ fn rpc_request(method: String, params: Vec<String>) -> Json {
object.insert("jsonrpc".to_string(), Json::String("2.0".to_string()));
object.insert(
"id".to_string(),
Json::String(format!("minisafe-cli-{}", process::id())),
Json::String(format!("liana-cli-{}", process::id())),
);
object.insert("method".to_string(), method);
object.insert("params".to_string(), params);
Expand All @@ -94,7 +94,7 @@ fn socket_file(conf_file: Option<PathBuf>) -> PathBuf {
[
data_dir,
config.bitcoin_config.network.to_string().as_str(),
"minisafed_rpc",
"lianad_rpc",
]
.iter()
.collect()
Expand Down Expand Up @@ -160,7 +160,7 @@ fn main() {
println!("{:#}", serde_json::json!({ "error": e }));
} else {
log::warn!(
"minisafed response doesn't contain result or error: '{}'",
"lianad response doesn't contain result or error: '{}'",
response
);
println!("{:#}", response);
Expand Down
4 changes: 2 additions & 2 deletions src/bin/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
process, thread, time,
};

use minisafe::{config::Config, DaemonHandle};
use liana::{config::Config, DaemonHandle};

fn parse_args(args: Vec<String>) -> Option<PathBuf> {
if args.len() == 1 {
Expand Down Expand Up @@ -61,7 +61,7 @@ fn main() {

let daemon = DaemonHandle::start_default(config).unwrap_or_else(|e| {
// The panic hook will log::error
panic!("Starting Minisafe daemon: {}", e);
panic!("Starting Liana daemon: {}", e);
});
daemon
.rpc_server()
Expand Down
12 changes: 6 additions & 6 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! # Minisafe commands
//! # Liana commands
//!
//! External interface to the Minisafe daemon.
//! External interface to the Liana daemon.
mod utils;

Expand Down Expand Up @@ -632,15 +632,15 @@ mod tests {

#[test]
fn getinfo() {
let ms = DummyMinisafe::new();
let ms = DummyLiana::new();
// We can query getinfo
ms.handle.control.get_info();
ms.shutdown();
}

#[test]
fn getnewaddress() {
let ms = DummyMinisafe::new();
let ms = DummyLiana::new();

let control = &ms.handle.control;
// We can get an address
Expand All @@ -661,7 +661,7 @@ mod tests {

#[test]
fn create_spend() {
let ms = DummyMinisafe::new();
let ms = DummyLiana::new();
let control = &ms.handle.control;

// Arguments sanity checking
Expand Down Expand Up @@ -777,7 +777,7 @@ mod tests {

#[test]
fn update_spend() {
let ms = DummyMinisafe::new();
let ms = DummyLiana::new();
let control = &ms.handle.control;
let mut db_conn = control.db().lock().unwrap().connection();

Expand Down
20 changes: 10 additions & 10 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ impl From<std::io::Error> for ConfigError {

impl std::error::Error for ConfigError {}

/// Get the absolute path to the minisafe configuration folder.
/// Get the absolute path to the liana configuration folder.
///
/// It's a "minisafe/<network>/" directory in the XDG standard configuration directory for
/// all OSes but Linux-based ones, for which it's `~/.minisafe/<network>/`.
/// There is only one config file at `minisafe/config.toml`, which specifies the network.
/// It's a "liana/<network>/" directory in the XDG standard configuration directory for
/// all OSes but Linux-based ones, for which it's `~/.liana/<network>/`.
/// There is only one config file at `liana/config.toml`, which specifies the network.
/// Rationale: we want to have the database, RPC socket, etc.. in the same folder as the
/// configuration file but for Linux the XDG specifoes a data directory (`~/.local/share/`)
/// different from the configuration one (`~/.config/`).
Expand All @@ -161,10 +161,10 @@ pub fn config_folder_path() -> Option<PathBuf> {

if let Some(mut path) = configs_dir {
#[cfg(target_os = "linux")]
path.push(".minisafe");
path.push(".liana");

#[cfg(not(target_os = "linux"))]
path.push("Minisafe");
path.push("Liana");

return Some(path);
}
Expand All @@ -174,7 +174,7 @@ pub fn config_folder_path() -> Option<PathBuf> {

fn config_file_path() -> Option<PathBuf> {
config_folder_path().map(|mut path| {
path.push("minisafe.toml");
path.push("liana.toml");
path
})
}
Expand Down Expand Up @@ -306,17 +306,17 @@ mod tests {
#[cfg(target_os = "linux")]
{
assert!(filepath.as_path().starts_with("/home/"));
assert!(filepath.as_path().ends_with(".minisafe/minisafe.toml"));
assert!(filepath.as_path().ends_with(".liana/liana.toml"));
}

#[cfg(target_os = "macos")]
assert!(filepath
.as_path()
.ends_with("Library/Application Support/Minisafe/minisafe.toml"));
.ends_with("Library/Application Support/Liana/liana.toml"));

#[cfg(target_os = "windows")]
assert!(filepath
.as_path()
.ends_with(r#"AppData\Roaming\Minisafe\minisafe.toml"#));
.ends_with(r#"AppData\Roaming\Liana\liana.toml"#));
}
}
2 changes: 1 addition & 1 deletion src/database/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///! Database interface for Minisafe.
///! Database interface for Liana.
///!
///! Record wallet metadata, spent and unspent coins, ongoing transactions.
pub mod sqlite;
Expand Down
4 changes: 2 additions & 2 deletions src/database/sqlite/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ mod tests {
fs::create_dir_all(&tmp_dir).unwrap();
let secp = secp256k1::Secp256k1::verification_only();

let db_path: path::PathBuf = [tmp_dir.as_path(), path::Path::new("minisafed.sqlite3")]
let db_path: path::PathBuf = [tmp_dir.as_path(), path::Path::new("lianad.sqlite3")]
.iter()
.collect();
let options = dummy_options();
Expand All @@ -578,7 +578,7 @@ mod tests {
fs::create_dir_all(&tmp_dir).unwrap();
let secp = secp256k1::Secp256k1::verification_only();

let db_path: path::PathBuf = [tmp_dir.as_path(), path::Path::new("minisafed.sqlite3")]
let db_path: path::PathBuf = [tmp_dir.as_path(), path::Path::new("lianad.sqlite3")]
.iter()
.collect();
assert!(SqliteDb::new(db_path.clone(), None, &secp)
Expand Down
16 changes: 8 additions & 8 deletions src/jsonrpc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fn connection_handler(
let req_id = req.id.clone();
if &req.method == "stop" {
shutdown.store(true, atomic::Ordering::Relaxed);
log::info!("Stopping the minisafe daemon.");
log::info!("Stopping the liana daemon.");
}

log::trace!("JSONRPC request: {:?}", serde_json::to_string(&req));
Expand Down Expand Up @@ -146,7 +146,7 @@ pub fn rpcserver_loop(

let handler_id = connections_counter.load(atomic::Ordering::Relaxed);
thread::Builder::new()
.name(format!("minisafe-jsonrpc-{}", handler_id))
.name(format!("liana-jsonrpc-{}", handler_id))
.spawn({
let control = daemon_control.clone();
let counter = connections_counter.clone();
Expand Down Expand Up @@ -260,7 +260,7 @@ mod tests {
#[test]
fn command_read_single() {
let socket_path = env::temp_dir().join(format!(
"minisafed-jsonrpc-socket-{}-{:?}",
"lianad-jsonrpc-socket-{}-{:?}",
process::id(),
thread::current().id()
));
Expand All @@ -287,7 +287,7 @@ mod tests {
#[test]
fn command_read_parts() {
let socket_path = env::temp_dir().join(format!(
"minisafed-jsonrpc-socket-{}-{:?}",
"lianad-jsonrpc-socket-{}-{:?}",
process::id(),
thread::current().id()
));
Expand Down Expand Up @@ -320,7 +320,7 @@ mod tests {
#[test]
fn command_read_multiple() {
let socket_path = env::temp_dir().join(format!(
"minisafed-jsonrpc-socket-{}-{:?}",
"lianad-jsonrpc-socket-{}-{:?}",
process::id(),
thread::current().id()
));
Expand Down Expand Up @@ -367,7 +367,7 @@ mod tests {
#[test]
fn command_read_linebreak() {
let socket_path = env::temp_dir().join(format!(
"minisafed-jsonrpc-socket-{}-{:?}",
"lianad-jsonrpc-socket-{}-{:?}",
process::id(),
thread::current().id()
));
Expand Down Expand Up @@ -400,12 +400,12 @@ mod tests {
#[cfg(not(target_os = "macos"))]
#[test]
fn server_sanity_check() {
let ms = DummyMinisafe::new();
let ms = DummyLiana::new();
let socket_path: path::PathBuf = [
ms.tmp_dir.as_path(),
path::Path::new("d"),
path::Path::new("bitcoin"),
path::Path::new("minisafed_rpc"),
path::Path::new("lianad_rpc"),
]
.iter()
.collect();
Expand Down
Loading

0 comments on commit 968a7d1

Please sign in to comment.