diff --git a/pkg/solana/txm/pendingtx.go b/pkg/solana/txm/pendingtx.go index c6216c11b..e650f8df6 100644 --- a/pkg/solana/txm/pendingtx.go +++ b/pkg/solana/txm/pendingtx.go @@ -403,8 +403,9 @@ func (c *pendingTxContext) OnFinalized(sig solana.Signature, retentionTimeout ti return id, nil } finalizedTx := finishedTx{ - state: Finalized, - retentionTs: time.Now().Add(retentionTimeout), + state: Finalized, + retentionTs: time.Now().Add(retentionTimeout), + rebroadcastCount: tx.rebroadcastCount, } // move transaction from confirmed to finalized map c.finalizedErroredTxs[id] = finalizedTx @@ -434,7 +435,8 @@ func (c *pendingTxContext) OnPrebroadcastError(id string, retentionTimeout time. // upgrade to write lock if id does not exist in other maps and is not in expected state already _, err = c.withWriteLock(func() (string, error) { - if tx, exists := c.finalizedErroredTxs[id]; exists && tx.state == txState { + tx, exists := c.finalizedErroredTxs[id] + if exists && tx.state == txState { return "", ErrAlreadyInExpectedState } _, broadcastedExists := c.broadcastedTxs[id] @@ -443,8 +445,9 @@ func (c *pendingTxContext) OnPrebroadcastError(id string, retentionTimeout time. return "", ErrIDAlreadyExists } erroredTx := finishedTx{ - state: txState, - retentionTs: time.Now().Add(retentionTimeout), + state: txState, + retentionTs: time.Now().Add(retentionTimeout), + rebroadcastCount: tx.rebroadcastCount, } // add transaction to error map c.finalizedErroredTxs[id] = erroredTx @@ -509,8 +512,9 @@ func (c *pendingTxContext) OnError(sig solana.Signature, retentionTimeout time.D return id, nil } erroredTx := finishedTx{ - state: txState, - retentionTs: time.Now().Add(retentionTimeout), + state: txState, + retentionTs: time.Now().Add(retentionTimeout), + rebroadcastCount: tx.rebroadcastCount, } // move transaction from broadcasted to error map c.finalizedErroredTxs[id] = erroredTx diff --git a/pkg/solana/txm/txm_internal_test.go b/pkg/solana/txm/txm_internal_test.go index 63703b484..6d7f979fe 100644 --- a/pkg/solana/txm/txm_internal_test.go +++ b/pkg/solana/txm/txm_internal_test.go @@ -798,7 +798,7 @@ func TestTxm_disabled_confirm_timeout_with_retention(t *testing.T) { LastValidBlockHeight: 100, Blockhash: solana.Hash{}, }, - }, nil).Once() + }, nil) t.Run("happyPath", func(t *testing.T) { // Test tx is not discarded due to confirm timeout and tracked to finalization