Skip to content

Commit

Permalink
fix: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
irrun committed Dec 17, 2024
1 parent 4206fa8 commit e00295d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions miner/worker_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ func (w *worker) simulateBundle(
if err != nil {
log.Warn("fail to simulate bundle", "hash", bundle.Hash().String(), "err", err)

if containsHash(bundle.DroppingTxHashes, receipt.TxHash) {
log.Warn("drop tx in bundle", "hash", receipt.TxHash.String())
if containsHash(bundle.DroppingTxHashes, tx.Hash()) {
log.Warn("drop tx in bundle", "hash", tx.Hash().String())
state = prevState
gasPool = prevGasPool
bundle.Txs = bundle.Txs.Remove(i)
Expand All @@ -448,7 +448,7 @@ func (w *worker) simulateBundle(
}

if receipt.Status == types.ReceiptStatusFailed && !containsHash(bundle.RevertingTxHashes, receipt.TxHash) {
// for failed tx whose state is unRevertible but itself can be dropped, we drop it and revert the state and gas pool
// for unRevertible tx but itself can be dropped, we drop it and revert the state and gas pool
if containsHash(bundle.DroppingTxHashes, receipt.TxHash) {
log.Warn("drop tx in bundle", "hash", receipt.TxHash.String())
state = prevState
Expand Down Expand Up @@ -496,6 +496,13 @@ func (w *worker) simulateBundle(
}
}

// prune bundle when all txs are dropped
if len(bundle.Txs) == 0 {
log.Warn("prune bundle", "hash", bundle.Hash().String(), "err", "empty bundle")
w.eth.TxPool().PruneBundle(bundle.Hash())
return nil, errors.New("empty bundle")
}

// if all txs in the bundle are from mempool, we accept the bundle without checking gas price
bundleGasPrice := big.NewInt(0)

Expand Down

0 comments on commit e00295d

Please sign in to comment.