Skip to content

Report Pathfinding Outcomes to Scorer in SimNode #291

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions sim-cli/src/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ pub async fn create_simulation_with_network(
(
Simulation<SimulationClock>,
Vec<ActivityDefinition>,
HashMap<PublicKey, Arc<Mutex<SimNode<SimGraph>>>>,
HashMap<PublicKey, Arc<Mutex<SimNode<SimGraph, SimulationClock>>>>,
),
anyhow::Error,
> {
Expand Down Expand Up @@ -313,7 +313,7 @@ pub async fn create_simulation_with_network(
// custom actions on the simulated network. For the nodes we'll pass our simulation, cast them
// to a dyn trait and exclude any nodes that shouldn't be included in random activity
// generation.
let nodes = ln_node_from_graph(simulation_graph.clone(), routing_graph).await;
let nodes = ln_node_from_graph(simulation_graph.clone(), routing_graph, clock.clone()).await?;
let mut nodes_dyn: HashMap<_, Arc<Mutex<dyn LightningNode>>> = nodes
.iter()
.map(|(pk, node)| (*pk, Arc::clone(node) as Arc<Mutex<dyn LightningNode>>))
Expand Down
7 changes: 6 additions & 1 deletion simln-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ pub enum LightningError {
/// Error that occurred while getting graph.
#[error("Get graph error: {0}")]
GetGraphError(String),
/// Error that occured when getting clock info.
#[error("SystemTime conversion error: {0}")]
SystemTimeConversionError(#[from] SystemTimeError),
}

/// Information about a Lightning Network node.
Expand Down Expand Up @@ -430,7 +433,7 @@ impl Display for PaymentResult {
}

/// Represents all possible outcomes of a Lightning Network payment attempt.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum PaymentOutcome {
/// Payment completed successfully, reaching its intended recipient.
Success,
Expand All @@ -456,6 +459,8 @@ pub enum PaymentOutcome {
NotDispatched,
/// The payment was dispatched but its final status could not be determined.
TrackPaymentFailed,
/// The payment failed at the provided index in the path.
IndexFailure(usize),
}

/// Describes a payment from a source node to a destination node.
Expand Down
Loading