mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-14 16:03:45 +00:00
fix(taiko_worker): fix a maxBytesPerTxList check issue (#282)
* fix(taiko_worker): fix a `maxBytesPerTxList` check issue * feat: more changes * feat: more changes
This commit is contained in:
parent
30a615b4c3
commit
f930382f4b
1 changed files with 13 additions and 13 deletions
|
|
@ -254,6 +254,7 @@ func (w *worker) commitL2Transactions(
|
||||||
env.txs = append(env.txs, firstTransaction)
|
env.txs = append(env.txs, firstTransaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loop:
|
||||||
for {
|
for {
|
||||||
// If we don't have enough gas for any further transactions then we're done.
|
// If we don't have enough gas for any further transactions then we're done.
|
||||||
if env.gasPool.Gas() < params.TxGas {
|
if env.gasPool.Gas() < params.TxGas {
|
||||||
|
|
@ -319,25 +320,24 @@ func (w *worker) commitL2Transactions(
|
||||||
env.tcount++
|
env.tcount++
|
||||||
txs.Shift()
|
txs.Shift()
|
||||||
|
|
||||||
|
// Encode and compress the txList, if the byte length is > maxBytesPerTxList, remove the latest tx and break.
|
||||||
|
b, err := encodeAndComporeessTxList(env.txs)
|
||||||
|
if err != nil {
|
||||||
|
log.Trace("Failed to rlp encode and compress the pending transaction %s: %w", tx.Hash(), err)
|
||||||
|
txs.Pop()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if len(b) > int(maxBytesPerTxList) {
|
||||||
|
lastTransaction = env.txs[env.tcount-1]
|
||||||
|
env.txs = env.txs[0 : env.tcount-1]
|
||||||
|
break loop
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
// Transaction is regarded as invalid, drop all consecutive transactions from
|
// Transaction is regarded as invalid, drop all consecutive transactions from
|
||||||
// the same sender because of `nonce-too-high` clause.
|
// the same sender because of `nonce-too-high` clause.
|
||||||
log.Trace("Transaction failed, account skipped", "hash", ltx.Hash, "err", err)
|
log.Trace("Transaction failed, account skipped", "hash", ltx.Hash, "err", err)
|
||||||
txs.Pop()
|
txs.Pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode and compress the txList, if the byte length is > maxBytesPerTxList, remove the latest tx and break.
|
|
||||||
b, err := encodeAndComporeessTxList(append(env.txs, tx))
|
|
||||||
if err != nil {
|
|
||||||
log.Trace("Failed to rlp encode and compress the pending transaction %s: %w", tx.Hash(), err)
|
|
||||||
txs.Pop()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if len(b) > int(maxBytesPerTxList) {
|
|
||||||
lastTransaction = env.txs[env.tcount-1]
|
|
||||||
env.txs = env.txs[0 : env.tcount-1]
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return lastTransaction
|
return lastTransaction
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue