Skip to content

Commit e505fc0

Browse files
authored
fix: extract file path from IPC URL in Transport::new_ipc (#6443)
1 parent fe21477 commit e505fc0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

chain/ethereum/src/transport.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,17 @@ pub enum Transport {
4242

4343
impl Transport {
4444
/// Creates an IPC transport.
45+
///
46+
/// Accepts both a raw file path (`/tmp/geth.ipc`) and an `ipc://` URL
47+
/// (`ipc:///tmp/geth.ipc`). When a URL is provided the file path is
48+
/// extracted so that the underlying IPC connector receives a plain path.
4549
#[cfg(unix)]
4650
pub async fn new_ipc(ipc: &str) -> Self {
47-
let transport = IpcConnect::new(ipc.to_string());
51+
let path = Url::parse(ipc)
52+
.ok()
53+
.map(|u| u.path().to_string())
54+
.unwrap_or_else(|| ipc.to_string());
55+
let transport = IpcConnect::new(path);
4856

4957
Transport::IPC(transport)
5058
}

0 commit comments

Comments
 (0)