Skip to content

Commit

Permalink
bugfix: adding deletion of invalid txs from pool db in the finalizer.
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolay Nedkov <nikolai_nedkov@yahoo.com>
  • Loading branch information
Psykepro committed Feb 24, 2023
1 parent 5994a08 commit 61fe998
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sequencer/finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,11 @@ func (f *finalizer) handleTransactionError(ctx context.Context, result *state.Pr
log.Errorf("ROM out of counters error, marking tx with Hash: %s as INVALID, errorCode: %s", tx.Hash.String(), errorCode.String())
start := time.Now()
f.worker.DeleteTx(tx.Hash, tx.From)
err := f.dbManager.DeleteTransactionFromPool(ctx, tx.Hash)
for err != nil {
log.Errorf("failed to delete tx from pool, err: %s", err)
err = f.dbManager.DeleteTransactionFromPool(ctx, tx.Hash)
}
metrics.WorkerProcessingTime(time.Since(start))
go func() {
err := f.dbManager.UpdateTxStatus(ctx, tx.Hash, pool.TxStatusInvalid)
Expand Down
1 change: 1 addition & 0 deletions sequencer/finalizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ func TestFinalizer_handleTransactionError(t *testing.T) {
if tc.expectedDeleteCall {
workerMock.On("DeleteTx", oldHash, sender).Return().Once()
dbManagerMock.On("UpdateTxStatus", ctx, oldHash, pool.TxStatusInvalid).Return(nil).Once()
dbManagerMock.On("DeleteTransactionFromPool", ctx, tx.Hash).Return(nil).Once()
}
if tc.expectedMoveCall {
workerMock.On("MoveTxToNotReady", oldHash, sender, &nonce, big.NewInt(0)).Return().Once()
Expand Down

0 comments on commit 61fe998

Please sign in to comment.