Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publisher tx lock for bundle #1925

Merged
merged 2 commits into from
May 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions go/host/l1/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ func (p *Publisher) PublishCrossChainBundle(bundle *common.ExtCrossChainBundle)
return fmt.Errorf("unable to get nonce for management contract. Cause: %w", err)
}

p.logger.Info("Host preparing to send cross chain bundle transaction")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to lock before you call PendingNonceAt I think, it'll out of date if there's one in-flight.

p.sendingLock.Lock()
defer p.sendingLock.Unlock()

transactor.Nonce = big.NewInt(0).SetUint64(nonce)

tx, err := managementCtr.AddCrossChainMessagesRoot(transactor, [32]byte(bundle.LastBatchHash.Bytes()), bundle.L1BlockHash, bundle.L1BlockNum, bundle.CrossChainRootHashes, bundle.Signature)
Expand Down
Loading