Skip to content

Commit

Permalink
Harden the mempool against a flood of new txs by discarding them earl…
Browse files Browse the repository at this point in the history
…ier in validation (#922)
  • Loading branch information
zmanian authored Dec 22, 2021
1 parent b41e070 commit e960233
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mempool/src/shared_mempool/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,17 @@ where
.enumerate()
.filter_map(|(idx, t)| {
if let Ok(sequence_number) = seq_numbers[idx] {
if t.sequence_number() >= sequence_number {
if t.sequence_number() == sequence_number {
return Some((t, sequence_number));
} else {
} else if t.sequence_number() > sequence_number{
statuses.push((
t,
(
MempoolStatus::new(MempoolStatusCode::VmError),
Some(DiscardedVMStatus::SEQUENCE_NUMBER_TOO_NEW),
),
));
}else {
statuses.push((
t,
(
Expand Down

0 comments on commit e960233

Please sign in to comment.