Commit 3a8c2ee4 authored by Michael de Hoog's avatar Michael de Hoog

Fix potential nil panics

parent 536340c4
......@@ -82,7 +82,7 @@ func (s *channelManager) TxFailed(id txID) {
}
s.metr.RecordBatchTxFailed()
if s.closed && len(s.confirmedTransactions) == 0 && len(s.pendingTransactions) == 0 {
if s.closed && len(s.confirmedTransactions) == 0 && len(s.pendingTransactions) == 0 && s.pendingChannel != nil {
s.log.Info("Channel has no submitted transactions, clearing for shutdown", "chID", s.pendingChannel.ID())
s.clearPendingChannel()
}
......
......@@ -212,6 +212,7 @@ func (l *BatchSubmitter) loadBlocksIntoState(ctx context.Context) {
latestBlock = block
}
if latestBlock != nil {
l2ref, err := derive.L2BlockToBlockRef(latestBlock, &l.Rollup.Genesis)
if err != nil {
l.log.Warn("Invalid L2 block loaded into state", "err", err)
......@@ -219,6 +220,7 @@ func (l *BatchSubmitter) loadBlocksIntoState(ctx context.Context) {
}
l.metr.RecordL2BlocksLoaded(l2ref)
}
}
// loadBlockIntoState fetches & stores a single block into `state`. It returns the block it loaded.
......
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