Skip to content

Commit ac400cf

Browse files
authored
Merge pull request #291 from chuksys/report-pathfinding-outcomes
Report Pathfinding Outcomes to Scorer in SimNode
2 parents 2dda472 + 5b490c0 commit ac400cf

File tree

3 files changed

+193
-48
lines changed

3 files changed

+193
-48
lines changed

sim-cli/src/parsing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ pub async fn create_simulation_with_network(
262262
(
263263
Simulation<SimulationClock>,
264264
Vec<ActivityDefinition>,
265-
HashMap<PublicKey, Arc<Mutex<SimNode<SimGraph>>>>,
265+
HashMap<PublicKey, Arc<Mutex<SimNode<SimGraph, SimulationClock>>>>,
266266
),
267267
anyhow::Error,
268268
> {
@@ -313,7 +313,7 @@ pub async fn create_simulation_with_network(
313313
// custom actions on the simulated network. For the nodes we'll pass our simulation, cast them
314314
// to a dyn trait and exclude any nodes that shouldn't be included in random activity
315315
// generation.
316-
let nodes = ln_node_from_graph(simulation_graph.clone(), routing_graph).await;
316+
let nodes = ln_node_from_graph(simulation_graph.clone(), routing_graph, clock.clone()).await?;
317317
let mut nodes_dyn: HashMap<_, Arc<Mutex<dyn LightningNode>>> = nodes
318318
.iter()
319319
.map(|(pk, node)| (*pk, Arc::clone(node) as Arc<Mutex<dyn LightningNode>>))

simln-lib/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ pub enum LightningError {
264264
/// Error that occurred while getting graph.
265265
#[error("Get graph error: {0}")]
266266
GetGraphError(String),
267+
/// Error that occured when getting clock info.
268+
#[error("SystemTime conversion error: {0}")]
269+
SystemTimeConversionError(#[from] SystemTimeError),
267270
}
268271

269272
/// Information about a Lightning Network node.
@@ -431,7 +434,7 @@ impl Display for PaymentResult {
431434
}
432435

433436
/// Represents all possible outcomes of a Lightning Network payment attempt.
434-
#[derive(Debug, Clone, Serialize, Deserialize)]
437+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
435438
pub enum PaymentOutcome {
436439
/// Payment completed successfully, reaching its intended recipient.
437440
Success,
@@ -457,6 +460,8 @@ pub enum PaymentOutcome {
457460
NotDispatched,
458461
/// The payment was dispatched but its final status could not be determined.
459462
TrackPaymentFailed,
463+
/// The payment failed at the provided index in the path.
464+
IndexFailure(usize),
460465
}
461466

462467
/// Describes a payment from a source node to a destination node.

0 commit comments

Comments
 (0)