Skip to content

Commit

Permalink
more trivial code clean in plug entry
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Dec 26, 2023
1 parent e934ca8 commit 122b067
Showing 1 changed file with 12 additions and 27 deletions.
39 changes: 12 additions & 27 deletions tx-pool/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,44 +993,29 @@ impl TxPoolService {
match target {
PlugTarget::Pending => {
for entry in entries {
if let Err(err) = tx_pool.add_pending(entry) {
error!("Plug entry add_pending error {}", err);
}
tx_pool
.add_pending(entry)
.expect("Plug entry add_pending error");
}
}
PlugTarget::Proposed => {
for entry in entries {
if let Err(err) = tx_pool.add_proposed(entry) {
error!("Plug entry add_proposed error {}", err);
}
tx_pool
.add_proposed(entry)
.expect("Plug entry add_proposed error");
}
}
};
}

if self.should_notify_block_assembler() {
match target {
PlugTarget::Pending => {
if self
.block_assembler_sender
.send(BlockAssemblerMessage::Pending)
.await
.is_err()
{
error!("block_assembler receiver dropped");
}
}
PlugTarget::Proposed => {
if self
.block_assembler_sender
.send(BlockAssemblerMessage::Proposed)
.await
.is_err()
{
error!("block_assembler receiver dropped");
}
}
let msg = match target {
PlugTarget::Pending => BlockAssemblerMessage::Pending,
PlugTarget::Proposed => BlockAssemblerMessage::Proposed,
};
if self.block_assembler_sender.send(msg).await.is_err() {
error!("block_assembler receiver dropped");
}
}
}

Expand Down

0 comments on commit 122b067

Please sign in to comment.