Update legacypool.go

Defense against Mempurge Attack
pull/28076/head
dwn1998 1 year ago committed by GitHub
parent a7842c9cae
commit 8b4f4e841e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      core/txpool/legacypool/legacypool.go

@ -883,6 +883,16 @@ func (pool *LegacyPool) promoteTx(addr common.Address, hash common.Hash, tx *typ
pendingDiscardMeter.Mark(1)
return false
}
//Check balance for Overdraft
balance := pool.currentState.GetBalance(addr)
if list.totalcost.Cmp(balance) > 0 {
pool.all.Remove(hash)
pool.priced.Removed(1)
pendingDiscardMeter.Mark(1)
return false
}
// Otherwise discard any previous transaction and mark this
if old != nil {
pool.all.Remove(old.Hash())

Loading…
Cancel
Save