Commit fc13e850 authored by Michael de Hoog's avatar Michael de Hoog

Small simplification

parent a1064b2a
...@@ -370,19 +370,14 @@ func (l *BatchSubmitter) handleReceipt(r txmgr.TxReceipt[txData]) { ...@@ -370,19 +370,14 @@ func (l *BatchSubmitter) handleReceipt(r txmgr.TxReceipt[txData]) {
} }
} }
// publishStateToL1Factory produces a publishStateToL1Job job // publishStateToL1Factory returns a txmgr factory function that pulls the block data
// loaded into `state`, and returns a txmgr transaction candidate that can be used to
// submit the associated data to the L1 in the form of channel frames. The factory
// will return an io.EOF error if no data is available.
func (l *BatchSubmitter) publishStateToL1Factory() txmgr.TxFactory[txData] { func (l *BatchSubmitter) publishStateToL1Factory() txmgr.TxFactory[txData] {
return func(ctx context.Context) (txmgr.TxCandidate, txData, error) { return func(ctx context.Context) (txmgr.TxCandidate, txData, error) {
return l.publishStateToL1Job(ctx) // this is called from a separate goroutine in the txmgr.Queue,
} // so lock to prevent concurrent access to the state
}
// publishStateToL1Job pulls the block data loaded into `state`, and returns a function that
// will submit the associated data to the L1 in the form of channel frames when called.
// Returns an io.EOF error if no data is available.
func (l *BatchSubmitter) publishStateToL1Job(ctx context.Context) (txmgr.TxCandidate, txData, error) {
// this is called from a separate goroutine in the tx queue, so we need
// to lock to prevent concurrent access to the state
l.publishLock.Lock() l.publishLock.Lock()
defer l.publishLock.Unlock() defer l.publishLock.Unlock()
...@@ -416,6 +411,7 @@ func (l *BatchSubmitter) publishStateToL1Job(ctx context.Context) (txmgr.TxCandi ...@@ -416,6 +411,7 @@ func (l *BatchSubmitter) publishStateToL1Job(ctx context.Context) (txmgr.TxCandi
GasLimit: intrinsicGas, GasLimit: intrinsicGas,
} }
return candidate, txdata, nil return candidate, txdata, nil
}
} }
func (l *BatchSubmitter) recordL1Tip(l1tip eth.L1BlockRef) { func (l *BatchSubmitter) recordL1Tip(l1tip eth.L1BlockRef) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment