Skip to content

Commit c5836a4

Browse files
docs(miner): rename circuitCapacityReached to circuitCapacityOrBlockTimeReached (#724)
* docs(miner): rename `circuitCapacityReached` to `ccOrBtReached` * minor * rename `ccOrBtReached` to `circuitCapacityOrBlockTimeReached`
1 parent 3592139 commit c5836a4

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

miner/worker.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -1019,11 +1019,11 @@ func (w *worker) commitTransactions(txs types.OrderedTransactionSet, coinbase co
10191019
l2CommitTxsTimer.Update(time.Since(t0))
10201020
}(time.Now())
10211021

1022-
var circuitCapacityReached bool
1022+
var circuitCapacityOrBlockTimeReached bool
10231023

10241024
// Short circuit if current is nil
10251025
if w.current == nil {
1026-
return true, circuitCapacityReached
1026+
return true, circuitCapacityOrBlockTimeReached
10271027
}
10281028

10291029
gasLimit := w.current.header.GasLimit
@@ -1058,12 +1058,12 @@ loop:
10581058
inc: true,
10591059
}
10601060
}
1061-
return atomic.LoadInt32(interrupt) == commitInterruptNewHead, circuitCapacityReached
1061+
return atomic.LoadInt32(interrupt) == commitInterruptNewHead, circuitCapacityOrBlockTimeReached
10621062
}
10631063
// seal block early if we're over time
10641064
// note: current.header.Time = max(parent.Time + cliquePeriod, now())
10651065
if w.current.tcount > 0 && w.chainConfig.Clique != nil && uint64(time.Now().Unix()) > w.current.header.Time {
1066-
circuitCapacityReached = true // skip subsequent invocations of commitTransactions
1066+
circuitCapacityOrBlockTimeReached = true // skip subsequent invocations of commitTransactions
10671067
break
10681068
}
10691069
// If we don't have enough gas for any further transactions then we're done
@@ -1187,7 +1187,7 @@ loop:
11871187
}
11881188
atomic.AddInt32(&w.newTxs, int32(1))
11891189

1190-
circuitCapacityReached = true
1190+
circuitCapacityOrBlockTimeReached = true
11911191
break loop
11921192
} else {
11931193
// 2. Circuit capacity limit reached in a block, and it's the first tx: skip the tx
@@ -1213,7 +1213,7 @@ loop:
12131213
// Reset ccc so that we can process other transactions for this block
12141214
w.circuitCapacityChecker.Reset()
12151215
log.Trace("Worker reset ccc", "id", w.circuitCapacityChecker.ID)
1216-
circuitCapacityReached = false
1216+
circuitCapacityOrBlockTimeReached = false
12171217

12181218
// Store skipped transaction in local db
12191219
if w.config.StoreSkippedTxTraces {
@@ -1241,7 +1241,7 @@ loop:
12411241
// Normally we would do `txs.Shift()` here.
12421242
// However, after `ErrUnknown`, ccc might remain in an
12431243
// inconsistent state, so we cannot pack more transactions.
1244-
circuitCapacityReached = true
1244+
circuitCapacityOrBlockTimeReached = true
12451245
w.checkCurrentTxNumWithCCC(w.current.tcount)
12461246
break loop
12471247

@@ -1261,7 +1261,7 @@ loop:
12611261
// However, after `ErrUnknown`, ccc might remain in an
12621262
// inconsistent state, so we cannot pack more transactions.
12631263
w.eth.TxPool().RemoveTx(tx.Hash(), true)
1264-
circuitCapacityReached = true
1264+
circuitCapacityOrBlockTimeReached = true
12651265
w.checkCurrentTxNumWithCCC(w.current.tcount)
12661266
break loop
12671267

@@ -1309,7 +1309,7 @@ loop:
13091309
if interrupt != nil {
13101310
w.resubmitAdjustCh <- &intervalAdjust{inc: false}
13111311
}
1312-
return false, circuitCapacityReached
1312+
return false, circuitCapacityOrBlockTimeReached
13131313
}
13141314

13151315
func (w *worker) checkCurrentTxNumWithCCC(expected int) {
@@ -1465,7 +1465,7 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64)
14651465
}
14661466
l2CommitNewWorkTidyPendingTxTimer.UpdateSince(tidyPendingStart)
14671467

1468-
var skipCommit, circuitCapacityReached bool
1468+
var skipCommit, circuitCapacityOrBlockTimeReached bool
14691469
commitL1MsgStart := time.Now()
14701470
if w.chainConfig.Scroll.ShouldIncludeL1Messages() && len(l1Messages) > 0 {
14711471
log.Trace("Processing L1 messages for inclusion", "count", len(l1Messages))
@@ -1474,7 +1474,7 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64)
14741474
log.Error("Failed to create L1 message set", "l1Messages", l1Messages, "err", err)
14751475
return
14761476
}
1477-
skipCommit, circuitCapacityReached = w.commitTransactions(txs, w.coinbase, interrupt)
1477+
skipCommit, circuitCapacityOrBlockTimeReached = w.commitTransactions(txs, w.coinbase, interrupt)
14781478
if skipCommit {
14791479
l2CommitNewWorkCommitL1MsgTimer.UpdateSince(commitL1MsgStart)
14801480
return
@@ -1486,12 +1486,12 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64)
14861486
if w.prioritizedTx != nil && w.current.header.Number.Uint64() > w.prioritizedTx.blockNumber {
14871487
w.prioritizedTx = nil
14881488
}
1489-
if !circuitCapacityReached && w.prioritizedTx != nil && w.current.header.Number.Uint64() == w.prioritizedTx.blockNumber {
1489+
if !circuitCapacityOrBlockTimeReached && w.prioritizedTx != nil && w.current.header.Number.Uint64() == w.prioritizedTx.blockNumber {
14901490
tx := w.prioritizedTx.tx
14911491
from, _ := types.Sender(w.current.signer, tx) // error already checked before
14921492
txList := map[common.Address]types.Transactions{from: []*types.Transaction{tx}}
14931493
txs := types.NewTransactionsByPriceAndNonce(w.current.signer, txList, header.BaseFee)
1494-
skipCommit, circuitCapacityReached = w.commitTransactions(txs, w.coinbase, interrupt)
1494+
skipCommit, circuitCapacityOrBlockTimeReached = w.commitTransactions(txs, w.coinbase, interrupt)
14951495
if skipCommit {
14961496
l2CommitNewWorkPrioritizedTxCommitTimer.UpdateSince(prioritizedTxStart)
14971497
return
@@ -1500,24 +1500,24 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64)
15001500
l2CommitNewWorkPrioritizedTxCommitTimer.UpdateSince(prioritizedTxStart)
15011501

15021502
remoteLocalStart := time.Now()
1503-
if len(localTxs) > 0 && !circuitCapacityReached {
1503+
if len(localTxs) > 0 && !circuitCapacityOrBlockTimeReached {
15041504
localTxPriceAndNonceStart := time.Now()
15051505
txs := types.NewTransactionsByPriceAndNonce(w.current.signer, localTxs, header.BaseFee)
15061506
l2CommitNewWorkLocalPriceAndNonceTimer.UpdateSince(localTxPriceAndNonceStart)
15071507

1508-
skipCommit, circuitCapacityReached = w.commitTransactions(txs, w.coinbase, interrupt)
1508+
skipCommit, circuitCapacityOrBlockTimeReached = w.commitTransactions(txs, w.coinbase, interrupt)
15091509
if skipCommit {
15101510
l2CommitNewWorkRemoteLocalCommitTimer.UpdateSince(remoteLocalStart)
15111511
return
15121512
}
15131513
}
15141514

1515-
if len(remoteTxs) > 0 && !circuitCapacityReached {
1515+
if len(remoteTxs) > 0 && !circuitCapacityOrBlockTimeReached {
15161516
remoteTxPriceAndNonceStart := time.Now()
15171517
txs := types.NewTransactionsByPriceAndNonce(w.current.signer, remoteTxs, header.BaseFee)
15181518
l2CommitNewWorkRemotePriceAndNonceTimer.UpdateSince(remoteTxPriceAndNonceStart)
15191519

1520-
// don't need to get `circuitCapacityReached` here because we don't have further `commitTransactions`
1520+
// don't need to get `circuitCapacityOrBlockTimeReached` here because we don't have further `commitTransactions`
15211521
// after this one, and if we assign it won't take effect (`ineffassign`)
15221522
skipCommit, _ = w.commitTransactions(txs, w.coinbase, interrupt)
15231523
if skipCommit {

0 commit comments

Comments
 (0)