diff --git a/tx-submitter/services/pendingtx.go b/tx-submitter/services/pendingtx.go index 03f23821..53276fb7 100644 --- a/tx-submitter/services/pendingtx.go +++ b/tx-submitter/services/pendingtx.go @@ -169,7 +169,7 @@ func (pt *PendingTxs) IncQueryTimes(txHash common.Hash) { pt.txinfos[txHash] = TxInfo{tx: pt.txinfos[txHash].tx, queryTimes: pt.txinfos[txHash].queryTimes + 1, sendTime: pt.txinfos[txHash].sendTime} } -func (pt *PendingTxs) SetFailedStatus(index uint64) { +func (pt *PendingTxs) TrySetFailedBatchIndex(index uint64) { pt.mu.Lock() defer pt.mu.Unlock() diff --git a/tx-submitter/services/pendingtx_test.go b/tx-submitter/services/pendingtx_test.go index 11d78c5e..71cb9ab7 100644 --- a/tx-submitter/services/pendingtx_test.go +++ b/tx-submitter/services/pendingtx_test.go @@ -11,7 +11,7 @@ func TestSetFailedStatus(t *testing.T) { pt := NewPendingTxs(nil, nil, nil) pt.SetPindex(2) require.Nil(t, pt.failedIndex) - pt.SetFailedStatus(2) + pt.TrySetFailedBatchIndex(2) require.NotNil(t, pt.failedIndex) require.EqualValues(t, 2, *pt.failedIndex) @@ -21,11 +21,11 @@ func TestSetFailedStatus(t *testing.T) { pt = NewPendingTxs(nil, nil, nil) failedIndex := uint64(2) pt.failedIndex = &failedIndex - pt.SetFailedStatus(3) + pt.TrySetFailedBatchIndex(3) require.EqualValues(t, 2, *pt.failedIndex) // set failed index without pindex -> failed pt = NewPendingTxs(nil, nil, nil) - pt.SetFailedStatus(2) + pt.TrySetFailedBatchIndex(2) require.Nil(t, pt.failedIndex) } diff --git a/tx-submitter/services/rollup.go b/tx-submitter/services/rollup.go index fe9cde5c..6042fe65 100644 --- a/tx-submitter/services/rollup.go +++ b/tx-submitter/services/rollup.go @@ -332,7 +332,7 @@ func (r *Rollup) ProcessTx() error { // happening between RemoveRollupRestriction // and SetPindex in the rollup function r.rollupFinalizeMu.Lock() - r.pendingTxs.SetFailedStatus(index) + r.pendingTxs.TrySetFailedBatchIndex(index) r.rollupFinalizeMu.Unlock() } @@ -713,7 +713,7 @@ func (r *Rollup) rollup() error { "err", err, "try_update_pooled_pending_index", cindex+1, ) - r.pendingTxs.SetFailedStatus(cindex + 1) + r.pendingTxs.TrySetFailedBatchIndex(cindex + 1) return nil }