Skip to content

Commit

Permalink
remove empty by_out_point entry
Browse files Browse the repository at this point in the history
Signed-off-by: Eval EXEC <execvy@gmail.com>
  • Loading branch information
eval-exec committed Oct 15, 2024
1 parent 0d38341 commit b257f59
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tx-pool/src/component/orphan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ impl OrphanPool {
self.entries.remove(id).map(|entry| {
debug!("remove orphan tx {}", entry.tx.hash());
for out_point in entry.tx.input_pts_iter() {
self.by_out_point
.get_mut(&out_point)
.map(|set| set.remove(id));
if let Some(ids_set) = self.by_out_point.get_mut(&out_point) {
ids_set.remove(id);

if ids_set.is_empty() {
self.by_out_point.remove(&out_point);
}
}
}
entry
})
Expand Down

0 comments on commit b257f59

Please sign in to comment.