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

(Requires merge by @wiz) Feat: Unix sockets for Electrum RPC #50

Merged
merged 1 commit into from
Oct 3, 2023
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: 1 addition & 0 deletions electrs-start-liquid
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ do
-- \
--network liquid \
--http-socket-file "${HOME}/socket/esplora-liquid-mainnet" \
--rpc-socket-file "${HOME}/socket/electrum-liquid-mainnet" \
--precache-scripts "${HOME}/electrs/contrib/popular-scripts.txt" \
--asset-db-path "${HOME}/asset_registry_db" \
--daemon-dir "${HOME}" \
Expand Down
1 change: 1 addition & 0 deletions electrs-start-liquidtestnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ do
-- \
--network liquidtestnet \
--http-socket-file "${HOME}/socket/esplora-liquid-testnet" \
--rpc-socket-file "${HOME}/socket/electrum-liquid-testnet" \
--precache-scripts "${HOME}/electrs/contrib/popular-scripts.txt" \
--asset-db-path "${HOME}/asset_registry_testnet_db" \
--daemon-dir "${HOME}" \
Expand Down
1 change: 1 addition & 0 deletions electrs-start-mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ do
--bin electrs \
-- \
--http-socket-file "${HOME}/socket/esplora-bitcoin-mainnet" \
--rpc-socket-file "${HOME}/socket/electrum-bitcoin-mainnet" \
--precache-scripts "${HOME}/electrs/contrib/popular-scripts.txt" \
--daemon-dir "${HOME}" \
--db-dir "/electrs" \
Expand Down
1 change: 1 addition & 0 deletions electrs-start-signet
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ do
-- \
--network signet \
--http-socket-file "${HOME}/socket/esplora-bitcoin-signet" \
--rpc-socket-file "${HOME}/socket/electrum-bitcoin-signet" \
--precache-scripts "${HOME}/electrs/contrib/popular-scripts.txt" \
--daemon-dir "${HOME}" \
--db-dir "/electrs" \
Expand Down
1 change: 1 addition & 0 deletions electrs-start-testnet
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ do
-- \
--network testnet \
--http-socket-file "${HOME}/socket/esplora-bitcoin-testnet" \
--rpc-socket-file "${HOME}/socket/electrum-bitcoin-testnet" \
--precache-scripts "${HOME}/electrs/contrib/popular-scripts.txt" \
--daemon-dir "${HOME}" \
--db-dir "/electrs" \
Expand Down
11 changes: 11 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub struct Config {
pub electrum_rpc_addr: SocketAddr,
pub http_addr: SocketAddr,
pub http_socket_file: Option<PathBuf>,
pub rpc_socket_file: Option<PathBuf>,
pub monitoring_addr: SocketAddr,
pub jsonrpc_import: bool,
pub light_mode: bool,
Expand Down Expand Up @@ -243,6 +244,14 @@ impl Config {
.takes_value(true),
);

#[cfg(unix)]
let args = args.arg(
Arg::with_name("rpc_socket_file")
.long("rpc-socket-file")
.help("Electrum RPC 'unix socket file' to listen on (default disabled, enabling this ignores the electrum_rpc_addr arg)")
.takes_value(true),
);

#[cfg(feature = "liquid")]
let args = args
.arg(
Expand Down Expand Up @@ -384,6 +393,7 @@ impl Config {
);

let http_socket_file: Option<PathBuf> = m.value_of("http_socket_file").map(PathBuf::from);
let rpc_socket_file: Option<PathBuf> = m.value_of("rpc_socket_file").map(PathBuf::from);
let monitoring_addr: SocketAddr = str_to_socketaddr(
m.value_of("monitoring_addr")
.unwrap_or(&format!("127.0.0.1:{}", default_monitoring_port)),
Expand Down Expand Up @@ -452,6 +462,7 @@ impl Config {
electrum_banner,
http_addr,
http_socket_file,
rpc_socket_file,
monitoring_addr,
mempool_backlog_stats_ttl: value_t_or_exit!(m, "mempool_backlog_stats_ttl", u64),
mempool_recent_txs_size: value_t_or_exit!(m, "mempool_recent_txs_size", usize),
Expand Down
Loading