Skip to content

Commit

Permalink
feat: change start protection
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniRamirezM committed Sep 9, 2024
1 parent 36e7297 commit 555f478
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sequencesender/sequencesender.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,19 @@ func New(cfg Config, etherman *etherman.Client, txBuilder txbuilder.TxBuilder) (

// Start starts the sequence sender
func (s *SequenceSender) Start(ctx context.Context) {
s.nonceMutex.Lock()
defer s.nonceMutex.Unlock()

// Start ethtxmanager client
go s.ethTxManager.Start()

// Get current nonce
var err error
s.nonceMutex.Lock()
s.currentNonce, err = s.etherman.CurrentNonce(ctx, s.cfg.L2Coinbase)
if err != nil {
log.Fatalf("failed to get current nonce from %v, error: %v", s.cfg.L2Coinbase, err)
} else {
log.Infof("current nonce for %v is %d", s.cfg.L2Coinbase, s.currentNonce)
}
s.nonceMutex.Unlock()

// Get latest virtual state batch from L1
err = s.updateLatestVirtualBatch()
Expand Down

0 comments on commit 555f478

Please sign in to comment.