Skip to content
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
150 changes: 123 additions & 27 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions ln-resource-mgr/src/forward_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ impl ForwardManager {
}
}

impl From<ForwardManagerParams> for ForwardManager {
fn from(params: ForwardManagerParams) -> Self {
ForwardManager::new(params)
}
}

impl SimulationDebugManager for ForwardManager {
fn general_jam_channel(&self, channel: u64) -> Result<(), ReputationError> {
self.inner
Expand Down
5 changes: 5 additions & 0 deletions ln-simln-jamming/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name = "ln-simln-jamming"
version = "0.1.0"
edition = "2021"

[features]
default = []
ldk-resource-manager = []

[[bin]]
name = "reputation-builder"
path = "src/bin/reputation_builder.rs"
Expand Down Expand Up @@ -31,5 +35,6 @@ humantime = "2.1.0"
rand = "0.9.1"
mockall = "0.13.1"
lightning = { version = "0.0.123" }
lightning-ldk = { package = "lightning", git = "https://github.com/elnosh/rust-lightning", rev = "0f397e8fe90691c8c3a28aadcaa68775a8d3ede0" }
tokio-util = { version = "0.7.15", features = ["rt"] }
ctrlc = "3.4.7"
36 changes: 19 additions & 17 deletions ln-simln-jamming/src/bin/forward_builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use async_trait::async_trait;
use bitcoin::secp256k1::PublicKey;
use clap::Parser;
use ln_resource_mgr::forward_manager::ForwardManager;
use ln_resource_mgr::{AllocationCheck, ProposedForward};
use ln_simln_jamming::analysis::ForwardReporter;
use ln_simln_jamming::clock::InstantClock;
Expand Down Expand Up @@ -75,24 +76,25 @@ async fn run(clock: Arc<SimulationClock>, cli: Cli) -> Result<(), BoxError> {
// Create a reputation interceptor without any bootstrap (since here we're creating the
// bootstrap itself, we just want to run with reputation active).
let traffic_file = network.traffic_file();
let reputation_interceptor = Arc::new(ReputationInterceptor::new_for_network(
cli.reputation_params.into(),
sim_network,
clock.clone(),
Some(Arc::new(Mutex::new(BootstrapWriter::new(
let reputation_interceptor =
Arc::new(ReputationInterceptor::<_, ForwardManager>::new_for_network(
cli.reputation_params.into(),
sim_network,
clock.clone(),
// TODO: change API in SimLN so that we can just pass a path in here.
traffic_file
.parent()
.ok_or("could not get traffic file directory")?
.to_path_buf(),
traffic_file
.file_name()
.unwrap()
.to_string_lossy()
.to_string(),
)?))),
)?);
Some(Arc::new(Mutex::new(BootstrapWriter::new(
clock.clone(),
// TODO: change API in SimLN so that we can just pass a path in here.
traffic_file
.parent()
.ok_or("could not get traffic file directory")?
.to_path_buf(),
traffic_file
.file_name()
.unwrap()
.to_string_lossy()
.to_string(),
)?))),
)?);
let latency_interceptor = Arc::new(LatencyIntercepor::new_poisson(300.0, Some(SIM_SEED))?);

let sim_cfg = SimulationCfg::new(
Expand Down
Loading
Loading