core/txpool/blobpool: fix data race in conversionQueue

This commit is contained in:
Felix Lange 2025-09-19 15:22:51 +02:00
parent d54a983742
commit fdc32a53ad

View file

@ -18,6 +18,7 @@ package blobpool
import ( import (
"errors" "errors"
"slices"
"sync/atomic" "sync/atomic"
"time" "time"
@ -130,10 +131,11 @@ func (q *conversionQueue) loop() {
if done == nil { if done == nil {
done, interrupt = make(chan struct{}), new(atomic.Int32) done, interrupt = make(chan struct{}), new(atomic.Int32)
tasks := cTasks tasks := slices.Clone(cTasks)
cTasks = cTasks[:0] cTasks = cTasks[:0]
go q.run(tasks, done, interrupt) go q.run(tasks, done, interrupt)
} }
case <-done: case <-done:
done, interrupt = nil, nil done, interrupt = nil, nil
@ -142,7 +144,7 @@ func (q *conversionQueue) loop() {
return return
} }
interrupt.Store(1) interrupt.Store(1)
log.Info("Waiting background converter to exit") log.Debug("Waiting for blob proof conversion to exit")
<-done <-done
return return
} }