mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Update legacypool.go
This commit is contained in:
parent
2e02c1ffd9
commit
eb9bfb4370
1 changed files with 11 additions and 0 deletions
|
|
@ -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())
|
||||
|
|
@ -892,6 +902,7 @@ func (pool *LegacyPool) promoteTx(addr common.Address, hash common.Hash, tx *typ
|
|||
// Nothing was replaced, bump the pending counter
|
||||
pendingGauge.Inc(1)
|
||||
}
|
||||
|
||||
// Set the potentially new pending nonce and notify any subsystems of the new tx
|
||||
pool.pendingNonces.set(addr, tx.Nonce()+1)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue