Skip to content

Commit

Permalink
refactor: Rename to handle outbound dlc messages
Browse files Browse the repository at this point in the history
  • Loading branch information
holzeis committed Feb 1, 2024
1 parent 1100555 commit ca191ca
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
6 changes: 4 additions & 2 deletions coordinator/src/bin/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ async fn main() -> Result<()> {
)?);

let dlc_handler = DlcHandler::new(pool.clone(), node.clone());
let _handle =
dlc_handler::spawn_handling_dlc_messages(dlc_handler, node_event_handler.subscribe());
let _handle = dlc_handler::spawn_handling_outbound_dlc_messages(
dlc_handler,
node_event_handler.subscribe(),
);

let event_handler = CoordinatorEventHandler::new(node.clone(), Some(node_event_sender));
let running = node.start(event_handler, false)?;
Expand Down
10 changes: 4 additions & 6 deletions coordinator/src/dlc_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ impl DlcHandler {
}
}

/// [`spawn_handling_dlc_messages`] handles sending outbound dlc messages as well as keeping track
/// of what dlc messages have already been processed and what was the last outbound dlc message
/// so it can be resend on reconnect.
///
/// It does not handle the incoming dlc messages!
pub fn spawn_handling_dlc_messages(
/// [`spawn_handling_outbound_dlc_messages`] handles sending outbound dlc messages as well as
/// keeping track of what dlc messages have already been processed and what was the last outbound
/// dlc message so it can be resend on reconnect.
pub fn spawn_handling_outbound_dlc_messages(
dlc_handler: DlcHandler,
mut receiver: broadcast::Receiver<NodeEvent>,
) -> RemoteHandle<()> {
Expand Down
4 changes: 1 addition & 3 deletions mobile/native/src/dlc_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ impl DlcHandler {
/// Handles sending outbound dlc messages as well as keeping track of what
/// dlc messages have already been processed and what was the last outbound dlc message
/// so it can be resend on reconnect.
///
/// Does not handle the incoming dlc messages!
pub async fn handle_dlc_messages(
pub async fn handle_outbound_dlc_messages(
dlc_handler: DlcHandler,
mut receiver: broadcast::Receiver<NodeEvent>,
) {
Expand Down
3 changes: 2 additions & 1 deletion mobile/native/src/ln_dlc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ pub fn run(seed_dir: String, runtime: &Runtime) -> Result<()> {

let dlc_handler = DlcHandler::new(node.clone());
runtime.spawn(async move {
dlc_handler::handle_dlc_messages(dlc_handler, node_event_handler.subscribe()).await
dlc_handler::handle_outbound_dlc_messages(dlc_handler, node_event_handler.subscribe())
.await
});

// Refresh the wallet balance and history eagerly so that it can complete before the
Expand Down

0 comments on commit ca191ca

Please sign in to comment.