mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-18 05:56:37 +00:00
refactor: improve readability of patch code
This commit is contained in:
parent
7d81b7c064
commit
53ba5182ce
1 changed files with 7 additions and 11 deletions
|
|
@ -568,18 +568,14 @@ func (pool *LegacyPool) validateTx(tx *types.Transaction) error {
|
||||||
FirstNonceGap: nil, // Pool allows arbitrary arrival order, don't invalidate nonce gaps
|
FirstNonceGap: nil, // Pool allows arbitrary arrival order, don't invalidate nonce gaps
|
||||||
UsedAndLeftSlots: nil, // Pool has own mechanism to limit the number of transactions
|
UsedAndLeftSlots: nil, // Pool has own mechanism to limit the number of transactions
|
||||||
ExistingExpenditure: func(addr common.Address) *big.Int {
|
ExistingExpenditure: func(addr common.Address) *big.Int {
|
||||||
list := pool.pending[addr]
|
result := new(big.Int)
|
||||||
queue, ok := pool.queue.get(addr)
|
if list := pool.pending[addr]; list != nil {
|
||||||
switch {
|
result.Add(result, list.totalcost.ToBig())
|
||||||
case list != nil && ok:
|
|
||||||
return new(big.Int).Add(list.totalcost.ToBig(), queue.totalcost.ToBig())
|
|
||||||
case list != nil:
|
|
||||||
return list.totalcost.ToBig()
|
|
||||||
case ok:
|
|
||||||
return queue.totalcost.ToBig()
|
|
||||||
default:
|
|
||||||
return new(big.Int)
|
|
||||||
}
|
}
|
||||||
|
if queue, ok := pool.queue.get(addr); ok {
|
||||||
|
result.Add(result, queue.totalcost.ToBig())
|
||||||
|
}
|
||||||
|
return result
|
||||||
},
|
},
|
||||||
ExistingCost: func(addr common.Address, nonce uint64) *big.Int {
|
ExistingCost: func(addr common.Address, nonce uint64) *big.Int {
|
||||||
if list := pool.pending[addr]; list != nil {
|
if list := pool.pending[addr]; list != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue