Skip to content

Commit 951d096

Browse files
committed
Make Trin compilable on Windows
1 parent b530dc3 commit 951d096

File tree

7 files changed

+15
-1
lines changed

7 files changed

+15
-1
lines changed

ethportal-peertest/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg(unix)]
12
pub mod constants;
23
pub mod scenarios;
34
pub mod utils;

portalnet/src/overlay_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ where
15201520
Request::PopulatedOffer(offer) => Ok(response_clone
15211521
.content_keys
15221522
.iter()
1523-
.zip(offer.content_items.into_iter())
1523+
.zip(offer.content_items)
15241524
.filter(|(is_accepted, _item)| *is_accepted)
15251525
.map(|(_is_accepted, (_key, val))| val)
15261526
.collect()),

portalnet/src/storage.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,8 @@ pub mod test {
11401140
// The restarted store should have the same radius as the original
11411141
assert_eq!(radius, new_storage.radius);
11421142

1143+
drop(storage);
1144+
drop(new_storage);
11431145
temp_dir.close()?;
11441146
Ok(())
11451147
}

src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ use trin_validation::{accumulator::MasterAccumulator, oracle::HeaderOracle};
2525
pub async fn run_trin(
2626
trin_config: TrinConfig,
2727
) -> Result<RpcServerHandle, Box<dyn std::error::Error>> {
28+
// Panic early on a windows build that is trying to use IPC, which is unsupported for now
29+
// Make sure not to panic on non-windows configurations.
30+
#[cfg(windows)]
31+
if let Web3TransportType::IPC = trin_config.web3_transport {
32+
panic!("Windows doesn't support Unix Domain Sockets IPC, use --web3-transport http");
33+
}
34+
2835
let trin_version = get_trin_version();
2936
info!("Launching Trin: v{trin_version}");
3037
info!(config = %trin_config, "With:");

src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#![warn(clippy::unwrap_used)]
22

33
use ethportal_api::types::cli::TrinConfig;
4+
#[cfg(windows)]
5+
use ethportal_api::types::cli::Web3TransportType;
46
use tracing::error;
57
use trin_utils::log::init_tracing_logger;
68

tests/rpc_server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg(unix)]
12
/// Test that a 3rd-party web3 client can understand our JSON-RPC API
23
use std::net::{IpAddr, Ipv4Addr};
34

tests/self_peertest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg(unix)]
12
use rpc::RpcServerHandle;
23
use std::env;
34
use std::net::{IpAddr, Ipv4Addr};

0 commit comments

Comments
 (0)