Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miner: log last tx hash before commit interrupt #1289

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion miner/test_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ func (w *worker) commitTransactionsWithDelay(env *environment, txs *transactions
}(chDeps)
}

var lastTxHash common.Hash

mainloop:
for {
if interruptCtx != nil {
Expand All @@ -551,7 +553,7 @@ mainloop:
select {
case <-interruptCtx.Done():
txCommitInterruptCounter.Inc(1)
log.Warn("Tx Level Interrupt")
log.Warn("Tx Level Interrupt", "hash", lastTxHash)
break mainloop
default:
}
Expand All @@ -573,6 +575,7 @@ mainloop:
if ltx == nil {
break
}
lastTxHash = ltx.Hash
// If we don't have enough space for the next transaction, skip the account.
if env.gasPool.Gas() < ltx.Gas {
log.Trace("Not enough gas left for transaction", "hash", ltx.Hash, "left", env.gasPool.Gas(), "needed", ltx.Gas)
Expand Down
5 changes: 4 additions & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,8 @@ func (w *worker) commitTransactions(env *environment, txs *transactionsByPriceAn
}(chDeps)
}

var lastTxHash common.Hash

mainloop:
for {
// Check interruption signal and abort building if it's fired.
Expand All @@ -974,7 +976,7 @@ mainloop:
select {
case <-interruptCtx.Done():
txCommitInterruptCounter.Inc(1)
log.Warn("Tx Level Interrupt")
log.Warn("Tx Level Interrupt", "hash", lastTxHash)
break mainloop
default:
}
Expand All @@ -990,6 +992,7 @@ mainloop:
if ltx == nil {
break
}
lastTxHash = ltx.Hash
// If we don't have enough space for the next transaction, skip the account.
if env.gasPool.Gas() < ltx.Gas {
log.Trace("Not enough gas left for transaction", "hash", ltx.Hash, "left", env.gasPool.Gas(), "needed", ltx.Gas)
Expand Down
Loading