Skip to content

Commit 0d41d25

Browse files
committed
core/txpool/legacypool: improve naming
Signed-off-by: Csaba Kiraly <[email protected]>
1 parent f2b434b commit 0d41d25

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

core/txpool/legacypool/legacypool.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,19 +1400,19 @@ func (pool *LegacyPool) reset(oldHead, newHead *types.Header) {
14001400
// invalidated transactions (low nonce, low balance) are deleted.
14011401
func (pool *LegacyPool) promoteExecutables(accounts []common.Address) []*types.Transaction {
14021402
gasLimit := pool.currentHead.Load().GasLimit
1403-
promoteable, removeable := pool.queue.promoteExecutables(accounts, gasLimit, pool.currentState, pool.pendingNonces)
1404-
promoted := make([]*types.Transaction, 0, len(promoteable))
1403+
promotable, dropped := pool.queue.promoteExecutables(accounts, gasLimit, pool.currentState, pool.pendingNonces)
1404+
promoted := make([]*types.Transaction, 0, len(promotable))
14051405

14061406
// promote all promoteable transactions
1407-
for _, tx := range promoteable {
1407+
for _, tx := range promotable {
14081408
from, _ := pool.signer.Sender(tx)
14091409
if pool.promoteTx(from, tx.Hash(), tx) {
14101410
promoted = append(promoted, tx)
14111411
}
14121412
}
14131413

14141414
// remove all removable transactions
1415-
for _, hash := range removeable {
1415+
for _, hash := range dropped {
14161416
pool.all.Remove(hash)
14171417
}
14181418

core/txpool/legacypool/queue.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ func (q *queue) add(hash common.Hash, tx *types.Transaction) (*common.Hash, erro
152152
// Returns two lists: all transactions that were removed from the queue and selected
153153
// for promotion; all other transactions that were removed from the queue and dropped.
154154
func (q *queue) promoteExecutables(accounts []common.Address, gasLimit uint64, currentState *state.StateDB, nonces *noncer) ([]*types.Transaction, []common.Hash) {
155-
// Track the promoteable transactions to broadcast them at once
156-
var promoteable []*types.Transaction
157-
var removeable []common.Hash
155+
// Track the promotable transactions to broadcast them at once
156+
var promotable []*types.Transaction
157+
var dropped []common.Hash
158158

159159
// Iterate over all accounts and promote any executable transactions
160160
for _, addr := range accounts {
@@ -165,40 +165,40 @@ func (q *queue) promoteExecutables(accounts []common.Address, gasLimit uint64, c
165165
// Drop all transactions that are deemed too old (low nonce)
166166
forwards := list.Forward(currentState.GetNonce(addr))
167167
for _, tx := range forwards {
168-
removeable = append(removeable, tx.Hash())
168+
dropped = append(dropped, tx.Hash())
169169
}
170170
log.Trace("Removing old queued transactions", "count", len(forwards))
171171
// Drop all transactions that are too costly (low balance or out of gas)
172172
drops, _ := list.Filter(currentState.GetBalance(addr), gasLimit)
173173
for _, tx := range drops {
174-
removeable = append(removeable, tx.Hash())
174+
dropped = append(dropped, tx.Hash())
175175
}
176176
log.Trace("Removing unpayable queued transactions", "count", len(drops))
177177
queuedNofundsMeter.Mark(int64(len(drops)))
178178

179179
// Gather all executable transactions and promote them
180180
readies := list.Ready(nonces.get(addr))
181-
promoteable = append(promoteable, readies...)
182-
log.Trace("Promoting queued transactions", "count", len(promoteable))
181+
promotable = append(promotable, readies...)
182+
log.Trace("Promoting queued transactions", "count", len(promotable))
183183
queuedGauge.Dec(int64(len(readies)))
184184

185185
// Drop all transactions over the allowed limit
186186
var caps = list.Cap(int(q.config.AccountQueue))
187187
for _, tx := range caps {
188188
hash := tx.Hash()
189-
removeable = append(removeable, hash)
189+
dropped = append(dropped, hash)
190190
log.Trace("Removing cap-exceeding queued transaction", "hash", hash)
191191
}
192192
queuedRateLimitMeter.Mark(int64(len(caps)))
193-
queuedGauge.Dec(int64(len(removeable)))
193+
queuedGauge.Dec(int64(len(dropped)))
194194

195195
// Delete the entire queue entry if it became empty.
196196
if list.Empty() {
197197
delete(q.queued, addr)
198198
delete(q.beats, addr)
199199
}
200200
}
201-
return promoteable, removeable
201+
return promotable, dropped
202202
}
203203

204204
func (q *queue) truncate() []common.Hash {

0 commit comments

Comments
 (0)