Skip to content

Commit

Permalink
refactor: is_empty
Browse files Browse the repository at this point in the history
  • Loading branch information
prestwich committed May 3, 2024
1 parent 6272676 commit b2338d8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/builder/src/tasks/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ impl InProgressBlock {
self.transactions.len()
}

/// Check if the block is empty.
pub fn is_empty(&self) -> bool {
self.transactions.is_empty()
}

/// Unseal the block
fn unseal(&mut self) {
self.raw_encoding.take();
Expand Down Expand Up @@ -98,7 +103,8 @@ impl BlockBuilder {
select! {
biased;
_ = &mut sleep => {
if !in_progress.transactions.is_empty() {
if !in_progress.is_empty() {
tracing::debug!(txns = in_progress.len(), "sending block to submit task");
let in_progress_block = std::mem::take(&mut in_progress);
if outbound.send(in_progress_block).is_err() {
tracing::debug!("downstream task gone");
Expand Down

0 comments on commit b2338d8

Please sign in to comment.