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

2003/861869/355072/6bc0861/a7a9d05 cleanup docs #1353

Closed
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
157 changes: 157 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
ifeq ($(project),)
PROJECT_NAME := $(notdir $(PWD))
else
PROJECT_NAME := $(project)
endif
export PROJECT_NAME
VERSION :=$(shell rustc -V)
export VERSION
TIME :=$(shell date +%s)
export TIME

OS :=$(shell uname -s)
export OS
OS_VERSION :=$(shell uname -r)
export OS_VERSION
ARCH :=$(shell uname -m)
export ARCH
ifeq ($(ARCH),x86_64)
TRIPLET :=x86_64-linux-gnu
export TRIPLET
endif
ifeq ($(ARCH),arm64)
TRIPLET :=aarch64-linux-gnu
export TRIPLET
endif
ifeq ($(ARCH),arm64)
TRIPLET :=aarch64-linux-gnu
export TRIPLET
endif

HOMEBREW :=$(shell which brew || false)

RUSTUP_INIT_SKIP_PATH_CHECK=yes
TOOLCHAIN=stable
Z= ##
ifneq ($(toolchain),)

ifeq ($(toolchain),nightly)
TOOLCHAIN=nightly
Z=-Z unstable-options
endif

ifeq ($(toolchain),stable)
TOOLCHAIN=stable
Z= ##
endif

endif

export RUSTUP_INIT_SKIP_PATH_CHECK
export TOOLCHAIN
export Z

#SUBMODULES=:$(shell cat .gitmodules | grep path | cut -d ' ' -f 3)
#export SUBMODULES

ifeq ($(verbose),)
VERBOSE :=-vv
else
VERBOSE :=$(verbose)
endif
export VERBOSE

#GIT CONFIG
GIT_USER_NAME := $(shell git config user.name || echo $(PROJECT_NAME))
export GIT_USER_NAME
GH_USER_NAME := $(shell git config user.name || echo $(PROJECT_NAME))
#MIRRORS
GH_USER_REPO := $(GH_USER_NAME).github.io
GH_USER_SPECIAL_REPO := $(GH_USER_NAME)
#GITHUB RUNNER CONFIGS
ifneq ($(ghuser),)
GH_USER_NAME := $(ghuser)
GH_USER_SPECIAL_REPO := $(ghuser)/$(ghuser)
endif
export GIT_USER_NAME
export GH_USER_REPO
export GH_USER_SPECIAL_REPO

GIT_USER_EMAIL := $(shell git config user.email || echo $(PROJECT_NAME))
export GIT_USER_EMAIL
GIT_SERVER := https://github.com
export GIT_SERVER
GIT_SSH_SERVER := [email protected]
export GIT_SSH_SERVER
GIT_PROFILE := $(shell git config user.name || echo $(PROJECT_NAME))
export GIT_PROFILE
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
export GIT_BRANCH
GIT_HASH := $(shell git rev-parse --short HEAD 2>/dev/null)
export GIT_HASH
GIT_PREVIOUS_HASH := $(shell git rev-parse --short master@{1} 2>/dev/null)
export GIT_PREVIOUS_HASH
GIT_REPO_ORIGIN := $(shell git remote get-url origin 2>/dev/null)
export GIT_REPO_ORIGIN
GIT_REPO_NAME := $(PROJECT_NAME)
export GIT_REPO_NAME
GIT_REPO_PATH := $(HOME)/$(GIT_REPO_NAME)
export GIT_REPO_PATH

.PHONY:- help
-:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?##/ {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@echo
help: ## help
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
#$(MAKE) -f Makefile help

-include Makefile

.PHONY: docs tests
doc: docs
docs: ## docs
cargo doc --all-features --no-deps --document-private-items
test: tests
tests: ## tests
## tests
## CONF=~/.liana/config.toml make tests
## for bin in $$(ls target/debug/liana*); do ./$${bin/.d} --conf $(CONF) 2>/dev/null; done
mkdir -p $(HOME)/.liana
cargo test -- --nocapture

## install rustup sequence
$(shell echo which rustup) || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --no-modify-path --default-toolchain stable --profile default #& . "$(HOME)/.cargo/env"

report:## print make variables
@echo ''
@echo 'TIME=${TIME}'
@echo 'PROJECT_NAME=${PROJECT_NAME}'
@echo 'VERSION=${VERSION}'
@echo ''
@echo 'OS=${OS}'
@echo 'OS_VERSION=${OS_VERSION}'
@echo 'ARCH=${ARCH}'
@echo ''
@echo 'SUBMODULES=${SUBMODULES}'
@echo ''
@echo 'GIT_USER_NAME=${GIT_USER_NAME}'
@echo 'GH_USER_REPO=${GH_USER_REPO}'
@echo 'GH_USER_SPECIAL_REPO=${GH_USER_SPECIAL_REPO}'
@echo 'KB_USER_REPO=${KB_USER_REPO}'
@echo 'GIT_USER_EMAIL=${GIT_USER_EMAIL}'
@echo 'GIT_SERVER=${GIT_SERVER}'
@echo 'GIT_PROFILE=${GIT_PROFILE}'
@echo 'GIT_BRANCH=${GIT_BRANCH}'
@echo 'GIT_HASH=${GIT_HASH}'
@echo 'GIT_PREVIOUS_HASH=${GIT_PREVIOUS_HASH}'
@echo 'GIT_REPO_ORIGIN=${GIT_REPO_ORIGIN}'
@echo 'GIT_REPO_NAME=${GIT_REPO_NAME}'
@echo 'GIT_REPO_PATH=${GIT_REPO_PATH}'
@echo ''
@echo 'VERBOSE=${VERBOSE}'

-include tests.mk

# vim: set noexpandtab:
# vim: set setfiletype make
13 changes: 9 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,16 @@ impl std::error::Error for ConfigError {}

/// Get the absolute path to the liana configuration folder.
///
/// 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>/`.
/// It is a `liana/<network>/` directory in the XDG standard configuration directory for
///
/// all OSes except Linux-based ones, for which it is `~/.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/`)
///
/// **Rationale:** We want to have the database, RPC socket, etc.. in the same folder as the
///
/// configuration file but for Linux the XDG specifies a data directory (`~/.local/share/`)
///
/// different from the configuration one (`~/.config/`).
pub fn config_folder_path() -> Option<PathBuf> {
#[cfg(target_os = "linux")]
Expand Down
2 changes: 1 addition & 1 deletion src/database/sqlite/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! > no single database connection is used simultaneously in two or more threads.
//!
//! We leverage SQLite's `unlock_notify` feature to synchronize writes accross connection. More
//! about it at https://sqlite.org/unlock_notify.html.
//! about it at <https://sqlite.org/unlock_notify.html>.

pub mod schema;
mod utils;
Expand Down
1 change: 1 addition & 0 deletions src/database/sqlite/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ impl TryFrom<&rusqlite::Row<'_>> for DbTip {

/// A row in the "wallets" table.
#[derive(Clone, Debug)]
#[allow(dead_code)]
pub struct DbWallet {
pub id: i64,
pub timestamp: u32,
Expand Down
8 changes: 4 additions & 4 deletions src/jsonrpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub enum ReqId {
Str(String),
}

/// A JSONRPC2 request. See https://www.jsonrpc.org/specification#request_object.
/// A JSONRPC2 request. See <https://www.jsonrpc.org/specification#request_object>.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Request {
Expand All @@ -54,7 +54,7 @@ pub struct Request {
/// A failure to broadcast a transaction to the P2P network.
const BROADCAST_ERROR: i64 = 1_000;

/// JSONRPC2 error codes. See https://www.jsonrpc.org/specification#error_object.
/// JSONRPC2 error codes. See <https://www.jsonrpc.org/specification#error_object>.
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum ErrorCode {
/// The method does not exist / is not available.
Expand Down Expand Up @@ -108,7 +108,7 @@ impl Serialize for ErrorCode {
}
}

/// JSONRPC2 error response. See https://www.jsonrpc.org/specification#error_object.
/// JSONRPC2 error response. See <https://www.jsonrpc.org/specification#error_object>.
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Error {
Expand Down Expand Up @@ -179,7 +179,7 @@ impl From<commands::CommandError> for Error {
}
}

/// JSONRPC2 response. See https://www.jsonrpc.org/specification#response_object.
/// JSONRPC2 response. See <https://www.jsonrpc.org/specification#response_object>.
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Response {
Expand Down
4 changes: 2 additions & 2 deletions src/spend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ fn select_coins_for_spend(
i if i >= 100 => 10_000,
_ => 100_000,
};
#[cfg(debug)]
#[cfg(debug_assertions)]
let bnb_rounds = bnb_rounds / 1_000;
if let Err(e) = selector.run_bnb(lowest_fee_change_cond, bnb_rounds) {
log::debug!(
Expand Down Expand Up @@ -570,7 +570,7 @@ pub trait TxGetter {

/// Specify the fee requirements for a transaction. In both cases set a target feerate in satoshi
/// per virtual byte. For RBF also set a minimum fee in satoshis for this transaction. See
/// https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md for more
/// <https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md> for more
/// information about how it should be set.
pub enum SpendTxFees {
/// The target feerate in sats/vb for this transaction.
Expand Down
Loading