Skip to content

Commit

Permalink
Merge pull request #23 from ethpandaops/fix/mimicry-race
Browse files Browse the repository at this point in the history
fix(execution/mimicry): data race for pooled txns
  • Loading branch information
Savid authored Apr 22, 2024
2 parents 16f9e19 + b4cab2e commit 2a5727b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/execution/mimicry/message_pooled_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ func (c *Client) handlePooledTransactions(ctx context.Context, code uint64, data
return err
}

if c.pooledTransactionsMap[txs.ReqID()] != nil {
c.pooledTransactionsMap[txs.ReqID()] <- txs
c.pooledTransactionsMux.Lock()
defer c.pooledTransactionsMux.Unlock()

channel, exists := c.pooledTransactionsMap[txs.ReqID()]
if exists && channel != nil {
channel <- txs
}

return nil
Expand Down

0 comments on commit 2a5727b

Please sign in to comment.