Skip to content

Commit

Permalink
chore: optimize block assembler notify fn
Browse files Browse the repository at this point in the history
  • Loading branch information
quake committed Dec 26, 2023
1 parent 7a3e0b7 commit 95ab359
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tx-pool/src/block_assembler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ impl BlockAssembler {
}

pub(crate) async fn notify(&self) {
if !self.need_to_notify() {
return;
}
let template = self.get_current().await;
if let Ok(template_json) = serde_json::to_string(&template) {
let notify_timeout = Duration::from_millis(self.config.notify_timeout_millis);
Expand Down Expand Up @@ -687,6 +690,10 @@ impl BlockAssembler {
}
}
}

fn need_to_notify(&self) -> bool {
!self.config.notify.is_empty() || !self.config.notify_scripts.is_empty()
}
}

#[derive(Clone)]
Expand Down

0 comments on commit 95ab359

Please sign in to comment.