Skip to content

Commit 5944847

Browse files
committed
multi: once off documentation comment sweep
1 parent c4a6fa9 commit 5944847

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

sim-lib/src/lib.rs

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -95,29 +95,29 @@ pub struct SimParams {
9595
/// [NodeId], which enables the use of public keys and aliases in the simulation description.
9696
#[derive(Debug, Clone, Serialize, Deserialize)]
9797
pub struct ActivityParser {
98-
// The source of the payment.
98+
/// The source of the payment.
9999
#[serde(with = "serializers::serde_node_id")]
100100
pub source: NodeId,
101-
// The destination of the payment.
101+
/// The destination of the payment.
102102
#[serde(with = "serializers::serde_node_id")]
103103
pub destination: NodeId,
104-
// The interval of the event, as in every how many seconds the payment is performed.
104+
/// The interval of the event, as in every how many seconds the payment is performed.
105105
pub interval_secs: u16,
106-
// The amount of m_sat to used in this payment.
106+
/// The amount of m_sat to used in this payment.
107107
pub amount_msat: u64,
108108
}
109109

110110
/// Data structure used internally by the simulator. Both source and destination are represented as [PublicKey] here.
111111
/// This is constructed during activity validation and passed along to the [Simulation].
112112
#[derive(Debug, Clone)]
113113
pub struct ActivityDefinition {
114-
// The source of the payment.
114+
/// The source of the payment.
115115
pub source: NodeInfo,
116-
// The destination of the payment.
116+
/// The destination of the payment.
117117
pub destination: NodeInfo,
118-
// The interval of the event, as in every how many seconds the payment is performed.
118+
/// The interval of the event, as in every how many seconds the payment is performed.
119119
pub interval_secs: u16,
120-
// The amount of m_sat to used in this payment.
120+
/// The amount of m_sat to used in this payment.
121121
pub amount_msat: u64,
122122
}
123123

@@ -135,7 +135,6 @@ pub enum SimulationError {
135135
RandomActivityError(RandomActivityError),
136136
}
137137

138-
// Phase 2: Event Queue
139138
#[derive(Debug, Error)]
140139
pub enum LightningError {
141140
#[error("Node connection error: {0}")]
@@ -204,8 +203,8 @@ pub trait LightningNode: Send {
204203
}
205204

206205
pub trait DestinationGenerator: Send {
207-
// choose_destination picks a destination node within the network, returning the node's information and its
208-
// capacity (if available).
206+
/// choose_destination picks a destination node within the network, returning the node's information and its
207+
/// capacity (if available).
209208
fn choose_destination(&self, source: PublicKey) -> (NodeInfo, Option<u64>);
210209
}
211210

@@ -214,10 +213,10 @@ pub trait DestinationGenerator: Send {
214213
pub struct PaymentGenerationError(String);
215214

216215
pub trait PaymentGenerator: Display + Send {
217-
// Returns the number of seconds that a node should wait until firing its next payment.
216+
/// Returns the number of seconds that a node should wait until firing its next payment.
218217
fn next_payment_wait(&self) -> time::Duration;
219218

220-
// Returns a payment amount based, with a destination capacity optionally provided to inform the amount picked.
219+
/// Returns a payment amount based, with a destination capacity optionally provided to inform the amount picked.
221220
fn payment_amount(
222221
&self,
223222
destination_capacity: Option<u64>,
@@ -324,14 +323,14 @@ enum SimulationOutput {
324323

325324
#[derive(Clone)]
326325
pub struct Simulation {
327-
// The lightning node that is being simulated.
326+
/// The lightning node that is being simulated.
328327
nodes: HashMap<PublicKey, Arc<Mutex<dyn LightningNode>>>,
329-
// The activity that are to be executed on the node.
328+
/// The activity that are to be executed on the node.
330329
activity: Vec<ActivityDefinition>,
331-
// High level triggers used to manage simulation tasks and shutdown.
330+
/// High level triggers used to manage simulation tasks and shutdown.
332331
shutdown_trigger: Trigger,
333332
shutdown_listener: Listener,
334-
// Total simulation time. The simulation will run forever if undefined.
333+
/// Total simulation time. The simulation will run forever if undefined.
335334
total_time: Option<time::Duration>,
336335
/// The expected payment size for the network.
337336
expected_payment_msat: u64,
@@ -425,7 +424,7 @@ impl Simulation {
425424
Ok(())
426425
}
427426

428-
// validates that the nodes are all on the same network and ensures that we're not running on mainnet.
427+
/// validates that the nodes are all on the same network and ensures that we're not running on mainnet.
429428
async fn validate_node_network(&self) -> Result<(), LightningError> {
430429
if self.nodes.is_empty() {
431430
return Err(LightningError::ValidationError(
@@ -531,8 +530,8 @@ impl Simulation {
531530
self.shutdown_trigger.trigger()
532531
}
533532

534-
// run_data_collection starts the tasks required for the simulation to report of the results of the activity that
535-
// it generates. The simulation should report outputs via the receiver that is passed in.
533+
/// run_data_collection starts the tasks required for the simulation to report of the results of the activity that
534+
/// it generates. The simulation should report outputs via the receiver that is passed in.
536535
fn run_data_collection(
537536
&self,
538537
output_receiver: Receiver<SimulationOutput>,
@@ -716,11 +715,11 @@ impl Simulation {
716715
}
717716
}
718717

719-
// consume_events processes events that are crated for a lightning node that we can execute events on. Any output
720-
// that is generated from the event being executed is piped into a channel to handle the result of the event. If it
721-
// exits, it will use the trigger provided to trigger shutdown in other threads. If an error occurs elsewhere, we
722-
// expect the senders corresponding to our receiver to be dropped, which will cause the receiver to error out and
723-
// exit.
718+
/// events that are crated for a lightning node that we can execute events on. Any output that is generated from the
719+
/// event being executed is piped into a channel to handle the result of the event. If it exits, it will use the
720+
/// trigger provided to trigger shutdown in other threads. If an error occurs elsewhere, we expect the senders
721+
/// corresponding to our receiver to be dropped, which will cause the receiver to error out and
722+
/// exit.
724723
async fn consume_events(
725724
node: Arc<Mutex<dyn LightningNode>>,
726725
mut receiver: Receiver<SimulationEvent>,
@@ -787,8 +786,8 @@ async fn consume_events(
787786
}
788787
}
789788

790-
// produce events generates events for the activity description provided. It accepts a shutdown listener so it can
791-
// exit if other threads signal that they have errored out.
789+
/// produce events generates events for the activity description provided. It accepts a shutdown listener so it can
790+
/// exit if other threads signal that they have errored out.
792791
async fn produce_events<N: DestinationGenerator + ?Sized, A: PaymentGenerator + ?Sized>(
793792
source: NodeInfo,
794793
network_generator: Arc<Mutex<N>>,

sim-lib/src/random_activity.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ pub struct NetworkGraphView {
2929
}
3030

3131
impl NetworkGraphView {
32-
// Creates a network view for the map of node public keys to capacity (in millisatoshis) provided. Returns an error
33-
// if any node's capacity is zero (the node cannot receive), or there are not at least two nodes (one node can't
34-
// send to itself).
32+
/// Creates a network view for the map of node public keys to capacity (in millisatoshis) provided. Returns an error
33+
/// if any node's capacity is zero (the node cannot receive), or there are not at least two nodes (one node can't
34+
/// send to itself).
3535
pub fn new(nodes: Vec<(NodeInfo, u64)>) -> Result<Self, RandomActivityError> {
3636
if nodes.len() < 2 {
3737
return Err(RandomActivityError::ValueError(

0 commit comments

Comments
 (0)