Skip to content

Commit

Permalink
fix listAllExpiredBroadcastedTxs
Browse files Browse the repository at this point in the history
  • Loading branch information
Farber98 committed Nov 30, 2024
1 parent 3a6e643 commit f4c6069
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions pkg/solana/txm/pendingtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,22 @@ func (c *pendingTxContext) ListAll() []solana.Signature {
func (c *pendingTxContext) ListAllExpiredBroadcastedTxs(currHeight uint64) []pendingTx {
c.lock.RLock()
defer c.lock.RUnlock()
broadcastedTxes := make([]pendingTx, 0, len(c.broadcastedProcessedTxs)) // worst case, all of them
for _, tx := range c.broadcastedProcessedTxs {
if tx.lastValidBlockHeight < currHeight {
broadcastedTxes = append(broadcastedTxes, tx)

expiredTxes := make([]pendingTx, 0, len(c.broadcastedProcessedTxs)) // worst case, all of them

for id, tx := range c.broadcastedProcessedTxs {
state, err := c.GetTxState(id)
if err != nil {
continue // Ignore transactions that are not found
}

// Check if the transaction is still in the Broadcasted state
if state == Broadcasted && tx.lastValidBlockHeight < currHeight {
expiredTxes = append(expiredTxes, tx)
}
}
return broadcastedTxes

return expiredTxes
}

// Expired returns if the timeout for trying to confirm a signature has been reached
Expand Down

0 comments on commit f4c6069

Please sign in to comment.