Skip to content
This repository has been archived by the owner on Apr 11, 2021. It is now read-only.

Commit

Permalink
rollup: check for nil tx before applying (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
tynes authored Apr 9, 2021
1 parent a1dbd1f commit 9a31c57
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rollup/sync_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,10 @@ func (s *SyncService) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Sub
// inspecting the local database. This is mean to prevent transactions from
// being replayed.
func (s *SyncService) maybeApplyTransaction(tx *types.Transaction) error {
if tx == nil {
return fmt.Errorf("nil transaction passed to maybeApplyTransaction")
}

log.Debug("Maybe applying transaction", "hash", tx.Hash().Hex())
index := tx.GetMeta().Index
if index == nil {
Expand Down Expand Up @@ -654,6 +658,10 @@ func (s *SyncService) applyTransaction(tx *types.Transaction) error {
// queue origin sequencer transactions, as the contracts on L1 manage the same
// validity checks that are done here.
func (s *SyncService) ApplyTransaction(tx *types.Transaction) error {
if tx == nil {
return fmt.Errorf("nil transaction passed to ApplyTransaction")
}

log.Debug("Sending transaction to sync service", "hash", tx.Hash().Hex())
s.txLock.Lock()
defer s.txLock.Unlock()
Expand Down

0 comments on commit 9a31c57

Please sign in to comment.